From 407aceb4dab36fc53684a4ea7dee4e2365fcbb9f Mon Sep 17 00:00:00 2001 From: proski Date: Mon, 14 Jul 2008 05:03:19 +0000 Subject: [PATCH] 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. --- ChangeLog | 4 ++++ kern/env.c | 7 +------ 2 files changed, 5 insertions(+), 6 deletions(-) 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);