From patchwork Thu Dec 6 04:02:27 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [mudflap] fix infinite recursion in verbose trace Date: Wed, 05 Dec 2012 18:02:27 -0000 From: Alexandre Oliva X-Patchwork-Id: 204126 Message-Id: To: gcc-patches@gcc.gnu.org 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 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