diff --git a/ChangeLog b/ChangeLog index fa8291b40..111179a78 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2008-07-14 Pavel Roskin + * 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/cmp.c (grub_cmd_cmp): Likewise. * kern/dl.c (grub_dl_flush_cache): Likewise. diff --git a/kern/env.c b/kern/env.c index a13989837..c47864824 100644 --- a/kern/env.c +++ b/kern/env.c @@ -331,12 +331,7 @@ grub_register_variable_hook (const char *name, if (! var) { - char *val = grub_strdup (""); - - if (! val) - return grub_errno; - - if (grub_env_set (name, val) != GRUB_ERR_NONE) + if (grub_env_set (name, "") != GRUB_ERR_NONE) return grub_errno; var = grub_env_find (name);