aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-03-09 19:11:10 +0100
committerMax Kellermann <max@duempel.org>2009-03-09 19:11:10 +0100
commitc5c86452ce9e53a8d3c5e6cccf660c5a17636f0a (patch)
tree3fa538e8019b61f7aed59b8d8672e331e8366420 /src
parent940af669b3a703145185c947e31d1d3374bc66da (diff)
downloadmpd-c5c86452ce9e53a8d3c5e6cccf660c5a17636f0a.tar.gz
mpd-c5c86452ce9e53a8d3c5e6cccf660c5a17636f0a.tar.xz
mpd-c5c86452ce9e53a8d3c5e6cccf660c5a17636f0a.zip
music_buffer: poison unallocated chunks
When a music chunk is freed (returned to the buffer), poison its memory.
Diffstat (limited to '')
-rw-r--r--src/buffer.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 1b300887f..cb2375ace 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -18,6 +18,7 @@
#include "buffer.h"
#include "chunk.h"
+#include "poison.h"
#include <glib.h>
@@ -51,10 +52,12 @@ music_buffer_new(unsigned num_chunks)
buffer->num_chunks = num_chunks;
chunk = buffer->available = buffer->chunks;
+ poison_undefined(chunk, sizeof(*chunk));
for (unsigned i = 1; i < num_chunks; ++i) {
chunk->next = &buffer->chunks[i];
chunk = chunk->next;
+ poison_undefined(chunk, sizeof(*chunk));
}
chunk->next = NULL;
@@ -116,6 +119,8 @@ music_buffer_return(struct music_buffer *buffer, struct music_chunk *chunk)
g_mutex_lock(buffer->mutex);
music_chunk_free(chunk);
+ poison_undefined(chunk, sizeof(*chunk));
+
chunk->next = buffer->available;
buffer->available = chunk;