diff --git a/ChangeLog b/ChangeLog index 825053ac3..7f8c41286 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2007-09-03 Yoshinori K. Okuji + * 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 + Do not use devices at boot in chainloading. * loader/i386/pc/chainloader.c (boot_drive): New variable. diff --git a/kern/rescue.c b/kern/rescue.c index 662964bbd..9d7da10e7 100644 --- a/kern/rescue.c +++ b/kern/rescue.c @@ -671,6 +671,7 @@ grub_enter_rescue_mode (void) val[0] = 0; grub_env_set (args[0], val + 1); val[0] = '='; + grub_free (args[0]); continue; } @@ -679,7 +680,10 @@ grub_enter_rescue_mode (void) /* If nothing is specified, restart. */ if (*name == '\0') - continue; + { + grub_free (args[0]); + continue; + } /* Find the command and execute it. */ 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 ("Try `help' for usage\n"); } + + grub_free (args[0]); } } diff --git a/normal/completion.c b/normal/completion.c index bad9e2292..e4b813ecf 100644 --- a/normal/completion.c +++ b/normal/completion.c @@ -473,18 +473,19 @@ grub_normal_do_completion (char *buf, int *restore, if (num_found == 1) grub_strcat (ret, suffix); - grub_free (match); - if (*ret == '\0') { grub_free (ret); - return 0; + goto fail; } + grub_free (argv[0]); + grub_free (match); return ret; } fail: + grub_free (argv[0]); grub_free (match); grub_errno = GRUB_ERR_NONE;