From eb54337c40cbedc79177b48d2feaea9d12e95c0f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 9 Aug 2012 20:55:18 +0200 Subject: decoder_control: duplicate the song object Make sure the decoder "owns" the song object, so nobody else can free it. --- src/decoder_control.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/decoder_control.c') diff --git a/src/decoder_control.c b/src/decoder_control.c index 8bf21365c..afcb16cdf 100644 --- a/src/decoder_control.c +++ b/src/decoder_control.c @@ -41,6 +41,8 @@ dc_new(GCond *client_cond) dc->state = DECODE_STATE_STOP; dc->command = DECODE_COMMAND_NONE; + dc->song = NULL; + dc->replay_gain_db = 0; dc->replay_gain_prev_db = 0; dc->mixramp_start = NULL; @@ -55,6 +57,9 @@ dc_free(struct decoder_control *dc) { dc_clear_error(dc); + if (dc->song != NULL) + song_free(dc->song); + g_cond_free(dc->cond); g_mutex_free(dc->mutex); g_free(dc->mixramp_start); @@ -129,6 +134,9 @@ dc_start(struct decoder_control *dc, struct song *song, assert(pipe != NULL); assert(music_pipe_empty(pipe)); + if (dc->song != NULL) + song_free(dc->song); + dc->song = song; dc->start_ms = start_ms; dc->end_ms = end_ms; -- cgit v1.2.3