From 57a095bc01f08d2e803331d521c09a90f8e33970 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Mon, 19 Jul 2010 01:01:53 +0530 Subject: [PATCH] fix a memory leak --- lib/arg.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/arg.c b/lib/arg.c index 400314d30..04e0ea8ba 100644 --- a/lib/arg.c +++ b/lib/arg.c @@ -228,9 +228,13 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv, grub_err_t add_arg (char *s) { + char **p = argl; argl = grub_realloc (argl, (++num) * sizeof (char *)); if (! argl) - return grub_errno; + { + grub_free (p); + return grub_errno; + } argl[num - 1] = s; return 0; }