fix a memory leak

This commit is contained in:
BVK Chaitanya 2010-07-19 01:01:53 +05:30
parent ec4689e82f
commit 57a095bc01

View file

@ -228,9 +228,13 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv,
grub_err_t add_arg (char *s) grub_err_t add_arg (char *s)
{ {
char **p = argl;
argl = grub_realloc (argl, (++num) * sizeof (char *)); argl = grub_realloc (argl, (++num) * sizeof (char *));
if (! argl) if (! argl)
{
grub_free (p);
return grub_errno; return grub_errno;
}
argl[num - 1] = s; argl[num - 1] = s;
return 0; return 0;
} }