From 4d55275031b61218790615a5c2e6d94db4b9e75f Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Tue, 10 Jul 2012 22:32:53 -0500 Subject: [PATCH] Bugfix: free allocated memory when exiting on fork error --- level_2/fll_execute/c/execute.c | 5 +++++ 1 file changed, 5 insertions(+) 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); } -- 1.8.3.1