From adf0649a918a7768562af2b483a04a1c05b27a1d Mon Sep 17 00:00:00 2001 From: rick Date: Thu, 18 Feb 2021 00:13:25 +0100 Subject: [PATCH] =?UTF-8?q?Patch=20fuite=20de=20m=C3=A9moire?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/shellOpt.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/shellOpt.c b/src/shellOpt.c index 01225a4..6be6fae 100644 --- a/src/shellOpt.c +++ b/src/shellOpt.c @@ -80,7 +80,14 @@ int main() get_command(commands, '|'); if (pipe(my_pipe) == -1) + { + for (int i = 0; i < MAX_LENGTH; i++) + { + free(args[i]); + free(commands[i]); + } error(1, FATAL_ERROR, NULL); + } index = 0; }