From fc2ab857f589c12048cebbb5d7289ec0a9ee5007 Mon Sep 17 00:00:00 2001 From: Spoike Date: Fri, 12 Oct 2012 00:22:32 +0000 Subject: [PATCH] clarified error message. also testing moodles' buildbot's email feature. mwahaha. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4123 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/qclib/initlib.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/engine/qclib/initlib.c b/engine/qclib/initlib.c index 1719277f6..0192bcc3f 100644 --- a/engine/qclib/initlib.c +++ b/engine/qclib/initlib.c @@ -288,7 +288,14 @@ static void PR_memfree (progfuncs_t *progfuncs, void *memptr) // PR_memvalidate(progfuncs); if (ptr < sizeof(qcmemusedblock_t) || ptr >= prinst->addressableused) { - printf("PF_memfree: pointer invalid - out of range (%u >= %u)\n", ptr, prinst->addressableused); + if (ptr < sizeof(qcmemusedblock_t) && !*(char*)memptr) + { + //the empty string is a point of contention. while we can detect it from fteqcc, its best to not give any special favours (other than nicer debugging, where possible) + //we might not actually spot it from other qccs, so warning about it where possible is probably a very good thing. + printf("PF_memfree: unable to free the non-null empty string constant\n", ptr, prinst->addressableused); + } + else + printf("PF_memfree: pointer invalid - out of range (%u >= %u)\n", ptr, prinst->addressableused); PR_StackTrace(progfuncs); return; } @@ -298,7 +305,7 @@ static void PR_memfree (progfuncs_t *progfuncs, void *memptr) ptr = (char*)ub - progfuncs->stringtable; if (ub->marker != MARKER || ub->size <= sizeof(*ub) || ptr + ub->size > (unsigned int)prinst->addressableused) { - printf("PF_memfree: memory corruption or double free\n"); + printf("PR_memfree: pointer lacks marker - double-freed?\n"); PR_StackTrace(progfuncs); return; }