aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-05-29 23:34:51 +0200
committerMax Kellermann <max@duempel.org>2009-05-29 23:34:51 +0200
commit1800bde3038f6af07d4b9383f30580c3da95c210 (patch)
treeea8e8b7f0107197dec88d30d60623bb85acf56ca
parenta90c4e5184780179249ba941d801ec8402ee335b (diff)
downloadmpd-1800bde3038f6af07d4b9383f30580c3da95c210.tar.gz
mpd-1800bde3038f6af07d4b9383f30580c3da95c210.tar.xz
mpd-1800bde3038f6af07d4b9383f30580c3da95c210.zip
player_thread: reinitialize music_buffer in !NDEBUG
To check for leaked music_chunk objects, free the music buffer on CLOSE_AUDIO. This invokes an assertion check which ensures that all chunks have been returned to the buffer.
-rw-r--r--src/player_thread.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/player_thread.c b/src/player_thread.c
index 4ea23020d..f00d1aba8 100644
--- a/src/player_thread.c
+++ b/src/player_thread.c
@@ -780,6 +780,15 @@ static gpointer player_task(G_GNUC_UNUSED gpointer arg)
case PLAYER_COMMAND_CLOSE_AUDIO:
audio_output_all_close();
player_command_finished();
+
+#ifndef NDEBUG
+ /* in the DEBUG build, check for leaked
+ music_chunk objects by freeing the
+ music_buffer */
+ music_buffer_free(player_buffer);
+ player_buffer = music_buffer_new(pc.buffer_chunks);
+#endif
+
break;
case PLAYER_COMMAND_EXIT: