2007-09-03 Yoshinori K. Okuji <okuji@enbug.org>

* kern/rescue.c (grub_enter_rescue_mode): Free ARGS.
    * normal/completion.c (grub_normal_do_completion): Likewise.
    Reported by Hitoshi Ozeki.
This commit is contained in:
okuji 2007-09-03 20:28:24 +00:00
parent 6139dcd953
commit 508e39ee41
3 changed files with 17 additions and 4 deletions

View file

@ -1,3 +1,9 @@
2007-09-03 Yoshinori K. Okuji <okuji@enbug.org>
* kern/rescue.c (grub_enter_rescue_mode): Free ARGS.
* normal/completion.c (grub_normal_do_completion): Likewise.
Reported by Hitoshi Ozeki.
2007-09-03 Yoshinori K. Okuji <okuji@enbug.org> 2007-09-03 Yoshinori K. Okuji <okuji@enbug.org>
Do not use devices at boot in chainloading. Do not use devices at boot in chainloading.

View file

@ -671,6 +671,7 @@ grub_enter_rescue_mode (void)
val[0] = 0; val[0] = 0;
grub_env_set (args[0], val + 1); grub_env_set (args[0], val + 1);
val[0] = '='; val[0] = '=';
grub_free (args[0]);
continue; continue;
} }
@ -679,7 +680,10 @@ grub_enter_rescue_mode (void)
/* If nothing is specified, restart. */ /* If nothing is specified, restart. */
if (*name == '\0') if (*name == '\0')
continue; {
grub_free (args[0]);
continue;
}
/* Find the command and execute it. */ /* Find the command and execute it. */
for (cmd = grub_rescue_command_list; cmd; cmd = cmd->next) for (cmd = grub_rescue_command_list; cmd; cmd = cmd->next)
@ -697,5 +701,7 @@ grub_enter_rescue_mode (void)
grub_printf ("Unknown command `%s'\n", name); grub_printf ("Unknown command `%s'\n", name);
grub_printf ("Try `help' for usage\n"); grub_printf ("Try `help' for usage\n");
} }
grub_free (args[0]);
} }
} }

View file

@ -473,18 +473,19 @@ grub_normal_do_completion (char *buf, int *restore,
if (num_found == 1) if (num_found == 1)
grub_strcat (ret, suffix); grub_strcat (ret, suffix);
grub_free (match);
if (*ret == '\0') if (*ret == '\0')
{ {
grub_free (ret); grub_free (ret);
return 0; goto fail;
} }
grub_free (argv[0]);
grub_free (match);
return ret; return ret;
} }
fail: fail:
grub_free (argv[0]);
grub_free (match); grub_free (match);
grub_errno = GRUB_ERR_NONE; grub_errno = GRUB_ERR_NONE;