]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix n-i-bz bug in auto free pool: a block using the last byte of the meta
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Wed, 5 Oct 2016 19:27:47 +0000 (19:27 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Wed, 5 Oct 2016 19:27:47 +0000 (19:27 +0000)
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

index 9fff02e3f97b2770fdfee32779d24fe788f2501c..e1c7b18c72aabf98b99459cd8f733c45b8fdb837 100644 (file)
@@ -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));