From f2dce97d5915503fc8aa0e8a7b403a69273f68e2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Luk=C3=A1=C5=A1=20Ji=C5=99i=C5=A1t=C4=9B?= Date: Mon, 19 Feb 2024 22:02:17 +0100 Subject: [PATCH] Fix a leak caused by repeating command by no input When no command is given, the previous action happens. But this action did not clean the input string "\n", which caused a leak. --- src/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main.c b/src/main.c index 7f2e2a4..5a0da55 100644 --- a/src/main.c +++ b/src/main.c @@ -227,7 +227,10 @@ int get_input(t_input *input, int fd) return (1); } if (str_inp[0] == '\n') + { + free(str_inp); return (1); + } if (str_inp[0] && str_inp[ft_strlen(str_inp) - 1] == '\n') str_inp[ft_strlen(str_inp) - 1] = '\0'; split_inp = ft_split(str_inp, ' '); -- 2.30.2