All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felix Zielcke <fzielcke@z-51.de>
To: The development of GNU GRUB <grub-devel@gnu.org>
Subject: [PATCH] Re: Bug in read_handler_list (autoloading) ???
Date: Thu, 12 Nov 2009 21:36:34 +0100	[thread overview]
Message-ID: <1258058194.4779.6.camel@fz.local> (raw)
In-Reply-To: <d019d53c0911120816x5f8e89cap915f262c4a30252f@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 341 bytes --]

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

[-- Attachment #2: fix_prefix_patch.diff --]
[-- Type: text/x-patch, Size: 1129 bytes --]

2009-11-12  Felix Zielcke  <fzielcke@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))


  reply	other threads:[~2009-11-12 20:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-11  4:00 Bug in read_handler_list (autoloading) ??? BVK
2009-11-12 16:16 ` BVK
2009-11-12 20:36   ` Felix Zielcke [this message]
2009-11-12 20:51     ` [PATCH] " Robert Millan
2009-11-13 22:43     ` Vladimir 'phcoder' Serbinenko
2009-11-14 15:35       ` Robert Millan
2009-11-14 21:11         ` Felix Zielcke
2009-11-15 11:10           ` Robert Millan
2010-01-07 18:48             ` Robert Millan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1258058194.4779.6.camel@fz.local \
    --to=fzielcke@z-51.de \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.