aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist_song.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-08-15 23:28:19 +0200
committerMax Kellermann <max@duempel.org>2012-08-16 00:04:14 +0200
commit3b8532f3fb379c7ecc6b64eecbbf9c824d18e875 (patch)
tree3313a43df3f120b74166749fdd75b07fa89846ba /src/playlist_song.c
parentf45616e5f6f7d6aa0fb5ca90a0599eacddf1166b (diff)
downloadmpd-3b8532f3fb379c7ecc6b64eecbbf9c824d18e875.tar.gz
mpd-3b8532f3fb379c7ecc6b64eecbbf9c824d18e875.tar.xz
mpd-3b8532f3fb379c7ecc6b64eecbbf9c824d18e875.zip
DatabasePlugin: add method ReturnSong()
Allow the plugin to allocate the GetSong() return value.
Diffstat (limited to '')
-rw-r--r--src/playlist_song.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/playlist_song.c b/src/playlist_song.c
index 29efef2e3..3b8de6307 100644
--- a/src/playlist_song.c
+++ b/src/playlist_song.c
@@ -79,9 +79,7 @@ apply_song_metadata(struct song *dest, const struct song *src)
(e.g. last track on a CUE file); fix it up here */
tmp->tag->time = dest->tag->time - src->start_ms / 1000;
- if (!song_in_database(dest))
- song_free(dest);
-
+ song_free(dest);
return tmp;
}
@@ -97,10 +95,13 @@ playlist_check_load_song(const struct song *song, const char *uri, bool secure)
if (dest == NULL)
return NULL;
} else {
- dest = db_get_song(uri);
- if (dest == NULL)
+ struct song *tmp = db_get_song(uri);
+ if (tmp == NULL)
/* not found in database */
return NULL;
+
+ dest = song_dup_detached(tmp);
+ db_return_song(tmp);
}
return apply_song_metadata(dest, song);