2008-07-14 Pavel Roskin <proski@gnu.org>

* kern/env.c (grub_register_variable_hook): Don't copy empty
	string, it leaks memory.  Pass "" to grub_env_set(), it should
	handle constant strings.
This commit is contained in:
proski 2008-07-14 05:03:19 +00:00
parent e4e8eaa5b3
commit 407aceb4da
2 changed files with 5 additions and 6 deletions

View file

@ -1,5 +1,9 @@
2008-07-14 Pavel Roskin <proski@gnu.org> 2008-07-14 Pavel Roskin <proski@gnu.org>
* kern/env.c (grub_register_variable_hook): Don't copy empty
string, it leaks memory. Pass "" to grub_env_set(), it should
handle constant strings.
* commands/blocklist.c (grub_cmd_blocklist): Fix format warning. * commands/blocklist.c (grub_cmd_blocklist): Fix format warning.
* commands/cmp.c (grub_cmd_cmp): Likewise. * commands/cmp.c (grub_cmd_cmp): Likewise.
* kern/dl.c (grub_dl_flush_cache): Likewise. * kern/dl.c (grub_dl_flush_cache): Likewise.

View file

@ -331,12 +331,7 @@ grub_register_variable_hook (const char *name,
if (! var) if (! var)
{ {
char *val = grub_strdup (""); if (grub_env_set (name, "") != GRUB_ERR_NONE)
if (! val)
return grub_errno;
if (grub_env_set (name, val) != GRUB_ERR_NONE)
return grub_errno; return grub_errno;
var = grub_env_find (name); var = grub_env_find (name);