summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/memblock.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2008-08-18 19:55:55 +0200
committerLennart Poettering <lennart@poettering.net>2008-08-18 19:55:55 +0200
commit5cc2187bec5923e13fb3958d57a5243aaa57b982 (patch)
tree1ae22aa811acd64f0163259655a5524c6686d970 /src/pulsecore/memblock.c
parentc6b18880bec79d5731619c148a8931ee18972bc3 (diff)
add some code to make invalid valgrind warnings go away
Diffstat (limited to 'src/pulsecore/memblock.c')
-rw-r--r--src/pulsecore/memblock.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/pulsecore/memblock.c b/src/pulsecore/memblock.c
index b43113d6..47909cdc 100644
--- a/src/pulsecore/memblock.c
+++ b/src/pulsecore/memblock.c
@@ -31,6 +31,10 @@
#include <signal.h>
#include <errno.h>
+#ifdef HAVE_VALGRIND_MEMCHECK_H
+#include <valgrind/memcheck.h>
+#endif
+
#include <pulse/xmalloc.h>
#include <pulse/def.h>
@@ -257,6 +261,10 @@ static struct mempool_slot* mempool_allocate_slot(pa_mempool *p) {
}
}
+#ifdef HAVE_VALGRIND_MEMCHECK_H
+ VALGRIND_MALLOCLIKE_BLOCK(slot, p->block_size, 0, 0);
+#endif
+
return slot;
}
@@ -519,7 +527,7 @@ static void memblock_free(pa_memblock *b) {
case PA_MEMBLOCK_POOL_EXTERNAL:
case PA_MEMBLOCK_POOL: {
struct mempool_slot *slot;
- int call_free;
+ pa_bool_t call_free;
slot = mempool_slot_by_ptr(b->pool, pa_atomic_ptr_load(&b->data));
pa_assert(slot);
@@ -532,6 +540,10 @@ static void memblock_free(pa_memblock *b) {
while (pa_flist_push(b->pool->free_slots, slot) < 0)
;
+#ifdef HAVE_VALGRIND_MEMCHECK_H
+ VALGRIND_FREELIKE_BLOCK(slot, b->pool->block_size);
+#endif
+
if (call_free)
if (pa_flist_push(PA_STATIC_FLIST_GET(unused_memblocks), b) < 0)
pa_xfree(b);