From: Philippe Waroquiers Date: Wed, 5 Oct 2016 19:27:47 +0000 (+0000) Subject: Fix n-i-bz bug in auto free pool: a block using the last byte of the meta X-Git-Tag: svn/VALGRIND_3_13_0~357 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d630e8a6fedba9962ad5b2104fbdef26de11bef2;p=thirdparty%2Fvalgrind.git Fix n-i-bz bug in auto free pool: a block using the last byte of the meta pool was not auto-freed. This was shown by: ./vg-in-place --leak-check=full ./memcheck/tests/leak-autofreepool 2 100 Without the patch, it reports 101 blocks leaked, with one block being from the auto-free meta pool. With the fix, there is (as expected) 100 leaked blocks. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16024 --- diff --git a/memcheck/mc_malloc_wrappers.c b/memcheck/mc_malloc_wrappers.c index 9fff02e3f9..e1c7b18c72 100644 --- a/memcheck/mc_malloc_wrappers.c +++ b/memcheck/mc_malloc_wrappers.c @@ -698,7 +698,7 @@ static void free_mallocs_in_mempool_block (MC_Mempool* mp, VG_(HT_ResetIter)(MC_(malloc_list)); while (!found && (mc = VG_(HT_Next)(MC_(malloc_list))) ) { - if (mc->data >= StartAddr && mc->data + mc->szB < EndAddr) { + if (mc->data >= StartAddr && mc->data + mc->szB <= EndAddr) { if (VG_(clo_verbosity) > 2) { VG_(message)(Vg_UserMsg, "Auto-free of 0x%lx size=%lu\n", mc->data, (mc->szB + 0UL));