From: Andrei Borzenkov Date: Tue, 12 Jan 2016 19:50:30 +0000 (+0300) Subject: script: fix memory leak X-Git-Tag: 2.02-beta3~77 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=b95e92678882f56056c64ae29092bc9cf129905f;p=thirdparty%2Fgrub.git script: fix memory leak Found by: Coverity scan. CID: 96637 --- diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c index bb70ebf17..a8502d907 100644 --- a/grub-core/script/execute.c +++ b/grub-core/script/execute.c @@ -681,18 +681,14 @@ grub_script_arglist_to_argv (struct grub_script_arglist *arglist, } *op = '\0'; - if (grub_script_argv_append (&result, p, op - p)) - { - grub_free (p); - need_cleanup = 1; - /* Fall through to cleanup */ - } + need_cleanup = grub_script_argv_append (&result, p, op - p); + grub_free (p); + /* Fall through to cleanup */ } else { - if (append (&result, values[i], 1)) - need_cleanup = 1; - /* Fall through to cleanup */ + need_cleanup = append (&result, values[i], 1); + /* Fall through to cleanup */ } }