From: Kevin Day Date: Wed, 11 Jul 2012 03:32:53 +0000 (-0500) Subject: Bugfix: free allocated memory when exiting on fork error X-Git-Tag: 0.4.0~2 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=4d55275031b61218790615a5c2e6d94db4b9e75f;p=fll Bugfix: free allocated memory when exiting on fork error --- diff --git a/level_2/fll_execute/c/execute.c b/level_2/fll_execute/c/execute.c index 4554198..eda64ae 100644 --- a/level_2/fll_execute/c/execute.c +++ b/level_2/fll_execute/c/execute.c @@ -76,6 +76,9 @@ extern "C"{ process_id = vfork(); if (process_id < 0) { + if (name_size > 0) f_delete_string(status, program_name, name_size); + f_delete((void **) & arguments_array, sizeof(f_autochar), arguments.used + 2); + return f_error_set_error(f_fork_failed); } @@ -135,6 +138,8 @@ extern "C"{ process_id = vfork(); if (process_id < 0) { + f_delete((void **) & arguments_array, sizeof(f_autochar), arguments.used + 2); + return f_error_set_error(f_fork_failed); }