aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder_control.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-08-09 20:55:18 +0200
committerMax Kellermann <max@duempel.org>2012-08-15 23:08:39 +0200
commiteb54337c40cbedc79177b48d2feaea9d12e95c0f (patch)
tree605176f21d8784541ea1965e4be7b7a2dcf6f4a3 /src/decoder_control.c
parent916a02017333ac32b8058d3c397eeb4ec85b742b (diff)
downloadmpd-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.c8
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;