From fd6a1bfb74603f245ac9d9b78564ff906f38145f Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Sun, 23 Oct 2011 15:38:02 +0000 Subject: [PATCH] Fix usage of DEBUG_ENFORCE_POOL_LOCKING with DEBUG_MEM Since DEBUG_MEM is storing own extra structure within returned memory chunk, glibc free must be used directly for posix_memaling() allocated block. --- WHATS_NEW_DM | 1 + libdm/mm/pool-fast.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM index da0b43bff..79be18f28 100644 --- a/WHATS_NEW_DM +++ b/WHATS_NEW_DM @@ -1,5 +1,6 @@ Version 1.02.68 - ================================== + Fix compile-time pool memory locking with DEBUG_MEM. Fix valgrind error reports in free of pool chunks with DEBUG_MEM. Align size of structure chunk for fast pool allocator to 8 bytes. Simplify some pointer operations in dm_free_aux() debug code. diff --git a/libdm/mm/pool-fast.c b/libdm/mm/pool-fast.c index 491c14207..dd41b6ece 100644 --- a/libdm/mm/pool-fast.c +++ b/libdm/mm/pool-fast.c @@ -306,7 +306,12 @@ static void _free_chunk(struct chunk *c) VALGRIND_MAKE_MEM_UNDEFINED(c + 1, c->end - (char *) (c + 1)); # endif #endif +#ifdef DEBUG_ENFORCE_POOL_LOCKING + /* since DEBUG_MEM is using own memory list */ + free(c); /* for posix_memalign() */ +#else dm_free(c); +#endif }