projects
/
FET_sim.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3895416
)
Fix a leak caused by repeating command by no input
author
Lukáš Jiřiště
<gymnazium.jiriste@gmail.com>
Mon, 19 Feb 2024 21:02:17 +0000
(22:02 +0100)
committer
Lukáš Jiřiště
<gymnazium.jiriste@gmail.com>
Mon, 19 Feb 2024 21:02:17 +0000
(22:02 +0100)
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
patch
|
blob
|
history
diff --git
a/src/main.c
b/src/main.c
index 7f2e2a446475586f3a2e0c90f13ab3a37d71a1ba..5a0da5589cbf2fbb2472b8c3a892994bc3bcded4 100644
(file)
--- 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, ' ');