From d630e8a6fedba9962ad5b2104fbdef26de11bef2 Mon Sep 17 00:00:00 2001 From: Philippe Waroquiers Date: Wed, 5 Oct 2016 19:27:47 +0000 Subject: [PATCH] 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 --- memcheck/mc_malloc_wrappers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)); -- 2.47.2