* grub-core/script/script.c (grub_script_parse): Free parsed on

failure.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-08-28 15:34:29 +02:00
parent 46422ebf1a
commit 2053cc077b
2 changed files with 10 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2010-08-28 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/script/script.c (grub_script_parse): Free parsed on
failure.
2010-08-28 Vladimir Serbinenko <phcoder@gmail.com> 2010-08-28 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/normal/completion.c (grub_normal_do_completion): Free argv * grub-core/normal/completion.c (grub_normal_do_completion): Free argv

View file

@ -365,7 +365,10 @@ grub_script_parse (char *script, grub_reader_getline_t getline)
parsestate = grub_zalloc (sizeof (*parsestate)); parsestate = grub_zalloc (sizeof (*parsestate));
if (!parsestate) if (!parsestate)
{
grub_free (parsed);
return 0; return 0;
}
/* Initialize the lexer. */ /* Initialize the lexer. */
lexstate = grub_script_lexer_init (parsestate, script, getline); lexstate = grub_script_lexer_init (parsestate, script, getline);
@ -388,6 +391,7 @@ grub_script_parse (char *script, grub_reader_getline_t getline)
grub_script_mem_free (memfree); grub_script_mem_free (memfree);
grub_script_lexer_fini (lexstate); grub_script_lexer_fini (lexstate);
grub_free (parsestate); grub_free (parsestate);
grub_free (parsed);
return 0; return 0;
} }