From bcfc62a3f2bd79faeef55234bcdfaa10c3577273 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 18 Oct 2013 01:12:47 +0200 Subject: PlaylistEdit, QueueSave: free the Song object after Append() Fix for a major memory leak. --- src/PlaylistEdit.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/PlaylistEdit.cxx') diff --git a/src/PlaylistEdit.cxx b/src/PlaylistEdit.cxx index 3cb68a1ab..9ef671a19 100644 --- a/src/PlaylistEdit.cxx +++ b/src/PlaylistEdit.cxx @@ -64,7 +64,9 @@ playlist::AppendFile(struct player_control &pc, if (song == nullptr) return PLAYLIST_RESULT_NO_SUCH_SONG; - return AppendSong(pc, song, added_id); + const auto result = AppendSong(pc, song, added_id); + song->Free(); + return result; } enum playlist_result @@ -125,6 +127,8 @@ playlist::AppendURI(struct player_control &pc, enum playlist_result result = AppendSong(pc, song, added_id); if (db != nullptr) db->ReturnSong(song); + else + song->Free(); return result; } -- cgit v1.2.3