default_free (GstAllocator * allocator, GstMemory * mem)
{
GstMemoryDefault *dmem = (GstMemoryDefault *) mem;
+ gsize slice_size;
if (dmem->notify)
dmem->notify (dmem->user_data);
- g_slice_free1 (dmem->slice_size, mem);
+ slice_size = dmem->slice_size;
+
+#ifdef USE_POISONING
+ /* just poison the structs, not all the data */
+ memset (mem, 0xff, sizeof (GstMemoryDefault));
+#endif
+
+ g_slice_free1 (slice_size, mem);
}
static void
}
/* we set msize to 0 when the buffer is part of the memory block */
- if (msize)
+ if (msize) {
+#ifdef USE_POISONING
+ memset (buffer, 0xff, msize);
+#endif
g_slice_free1 (msize, buffer);
- else
+ } else {
gst_memory_unref (GST_BUFFER_BUFMEM (buffer));
+ }
}
static void