mudflap's free overrider, when verbose traces enabled, calls output
functions that, at least on the version of glibc I'm using, calls free
recursively.  Since it happens to be free(NULL), it's quite easy to fix
this problem with the following simple patch.  Ok to install?

Avoid infinite recursion on verbose mudflap

From: Alexandre Oliva <aol...@redhat.com>

for  libmudflap/ChangeLog

	* mf-hooks1.c (free): Return on NULL before any logging.
---

 libmudflap/mf-hooks1.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/libmudflap/mf-hooks1.c b/libmudflap/mf-hooks1.c
index 3dd332e..7a27321 100644
--- a/libmudflap/mf-hooks1.c
+++ b/libmudflap/mf-hooks1.c
@@ -238,11 +238,11 @@ WRAPPER(void, free, void *buf)
   static int freeq_initialized = 0;
   DECLARE(void, free, void *);
 
-  BEGIN_PROTECT (free, buf);
-
   if (UNLIKELY(buf == NULL))
     return;
 
+  BEGIN_PROTECT (free, buf);
+
 #if PIC
   /* Check whether the given buffer might have come from a
      __mf_0fn_malloc/calloc call that for whatever reason was not

-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer

Reply via email to