From: Julian Seward Date: Thu, 29 May 2008 12:30:58 +0000 (+0000) Subject: Merge r8144 (partial fix for mc_leakcheck.c:698 assert) X-Git-Tag: svn/VALGRIND_3_3_1~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c370925881a752eb5d1ea940daa6e5efe4a77269;p=thirdparty%2Fvalgrind.git Merge r8144 (partial fix for mc_leakcheck.c:698 assert) git-svn-id: svn://svn.valgrind.org/valgrind/branches/VALGRIND_3_3_BRANCH@8146 --- diff --git a/memcheck/mc_leakcheck.c b/memcheck/mc_leakcheck.c index fc94fb7a09..d781e0bdca 100644 --- a/memcheck/mc_leakcheck.c +++ b/memcheck/mc_leakcheck.c @@ -692,10 +692,22 @@ void MC_(do_detect_memory_leaks) ( tl_assert( lc_shadows[i]->data <= lc_shadows[i+1]->data); } - /* Sanity check -- make sure they don't overlap */ + /* Sanity check -- make sure they don't overlap. But do allow + exact duplicates. If this assertion fails, it may mean that the + application has done something stupid with + VALGRIND_MALLOCLIKE_BLOCK client requests, specifically, has + made overlapping requests (which are nonsensical). Another way + to screw up is to use VALGRIND_MALLOCLIKE_BLOCK for stack + locations; again nonsensical. */ for (i = 0; i < lc_n_shadows-1; i++) { - tl_assert( lc_shadows[i]->data + lc_shadows[i]->szB - <= lc_shadows[i+1]->data ); + tl_assert( /* normal case - no overlap */ + (lc_shadows[i]->data + lc_shadows[i]->szB + <= lc_shadows[i+1]->data ) + || + /* degenerate case: exact duplicates */ + (lc_shadows[i]->data == lc_shadows[i+1]->data + && lc_shadows[i]->szB == lc_shadows[i+1]->szB) + ); } if (lc_n_shadows == 0) {