From 70abc7023b42b2e19cc41760df09cf9a82bded6e Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Thu, 22 Jul 2010 21:13:45 +0530 Subject: [PATCH 1/2] fix a memory issue --- script/script.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/script/script.c b/script/script.c index 6509b5f5d..8d856c493 100644 --- a/script/script.c +++ b/script/script.c @@ -95,8 +95,9 @@ void grub_script_free (struct grub_script *script) { struct grub_script *s; + struct grub_script *t; - if (!script) + if (! script) return; if (script->mem) @@ -104,8 +105,9 @@ grub_script_free (struct grub_script *script) s = script->children; while (s) { + t = s->siblings; grub_script_put (s); - s = s->siblings; + s = t; } grub_free (script); } From 88513a523636adfd76db27cdab93ad183fd1d2d2 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Thu, 22 Jul 2010 22:50:04 +0530 Subject: [PATCH 2/2] removed unnecessary grammar rules --- script/parser.y | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/script/parser.y b/script/parser.y index 4f57ea4ff..ce97ab174 100644 --- a/script/parser.y +++ b/script/parser.y @@ -81,7 +81,7 @@ %token GRUB_PARSER_TOKEN_WORD "word" %type block block0 -%type word argument parameters0 parameters1 arguments0 arguments1 +%type word argument arguments0 arguments1 %type script_init script %type grubcmd ifclause ifcmd forcmd whilecmd untilcmd @@ -236,22 +236,7 @@ arguments1: argument arguments0 } ; -parameters1: argument parameters0 - { - if ($1 && $2) - { - $1->next = $2; - $1->argcount += $2->argcount; - $2->argcount = 0; - } - $$ = $1; - } -; -parameters0: /* Empty */ { $$ = 0; } - | parameters1 { $$ = $1; } -; - -grubcmd: word parameters0 block0 +grubcmd: word arguments0 block0 { struct grub_script_arglist *x = $2;