Skip to contentSkip to conversation

bug on context

PATCH zhanghuan 1 participant 1 message Mar 12, 2008

lore
Share & tools
lore

zhanghuan

author
#0 lore raw

hi all.

Here is a patch fixing a bug on MM error while returning to previous menu. The following steps should issue the bug:
1. write a menuentry using configfile command to load another menu file;
2. press 'ESC' to return to previous one;
3. repeat 1 and then repeat 2.

After looking into the code, I found that when a context is close, it frees all variables of the previous context instead of what it owned.

Zhang Huan
Tel: (86)10-6260-0549
Mailing: P. O. Box 2704# Beijing
Postcode: 100080
National Research Centre for High Performance Computers Institute of Computing Technology, Chinese Academy of Sciences No. 6, South Kexueyuan Road, Haidian District Beijing, China

kern/env.c +1 -1
diff -ur grub-1.96/kern/env.c grub-1.96fix/kern/env.c
@@ -124,7 +124,7 @@
     {
       struct grub_env_var *p, *q;
       
-      for (p = current_context->prev->vars[i]; p; p = q)
+      for (p = current_context->vars[i]; p; p = q)
 	{
 	  q = p->next;
 	  grub_free (p);