Am Donnerstag, den 12.11.2009, 21:46 +0530 schrieb BVK:
> Valgrind log is attached. It also reported invalid free for the same place.
> 
> BTW, valgrind is run as
> 
>     sudo valgrind -v --log-file=/tmp/valgrind.log ./grub-emu

Here's a grub-emu tested patch to fix this



-- 
Felix Zielcke
Proud Debian Maintainer and GNU GRUB developer
2009-11-12  Felix Zielcke  <fziel...@z-51.de>

	* normal/handler.c (read_handler_list): Use grub_handler_unregister
	to properly remove the handlers.  Skip `rescue' and `console'
	handlers defined in kernel.

=== modified file 'normal/handler.c'
--- normal/handler.c	2009-11-09 14:55:27 +0000
+++ normal/handler.c	2009-11-12 20:31:00 +0000
@@ -176,14 +176,21 @@ read_handler_list (void)
 	  if (file)
 	    {
 	      char *buf = NULL;
-
+	      grub_handler_class_t hcnext, hc = grub_handler_class_list;
+	      grub_handler_t hl;
 	      /* Override previous handler.lst.  */
-	      while (grub_handler_class_list)
+	      for (; hc ; hc = hcnext)
 		{
-		  grub_handler_class_t tmp;
-		  tmp = grub_handler_class_list->next;
-		  grub_free (grub_handler_class_list);
-		  grub_handler_class_list = tmp;
+		  hcnext = hc->next;
+		  hl = hc->handler_list;
+		  while (hl)
+		    {
+		      grub_handler_t tmp = hl->next;
+		      if (grub_strcmp (hl->name, "rescue") != 0
+			  && grub_strcmp (hl->name, "console") != 0)
+			grub_handler_unregister (hc,hl);
+		      hl = tmp;
+		    }
 		}
 
 	      for (;; grub_free (buf))

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to