diff options
author | Max Kellermann <max@duempel.org> | 2012-08-09 20:55:18 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2012-08-15 23:08:39 +0200 |
commit | eb54337c40cbedc79177b48d2feaea9d12e95c0f (patch) | |
tree | 605176f21d8784541ea1965e4be7b7a2dcf6f4a3 /src/decoder_control.c | |
parent | 916a02017333ac32b8058d3c397eeb4ec85b742b (diff) | |
download | mpd-eb54337c40cbedc79177b48d2feaea9d12e95c0f.tar.gz mpd-eb54337c40cbedc79177b48d2feaea9d12e95c0f.tar.xz mpd-eb54337c40cbedc79177b48d2feaea9d12e95c0f.zip |
decoder_control: duplicate the song object
Make sure the decoder "owns" the song object, so nobody else can free
it.
Diffstat (limited to '')
-rw-r--r-- | src/decoder_control.c | 8 |
1 files changed, 8 insertions, 0 deletions
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; |