PlaylistEdit, QueueSave: free the Song object after Append()
Fix for a major memory leak.
This commit is contained in:
parent
d1924867db
commit
bcfc62a3f2
@ -64,7 +64,9 @@ playlist::AppendFile(struct player_control &pc,
|
|||||||
if (song == nullptr)
|
if (song == nullptr)
|
||||||
return PLAYLIST_RESULT_NO_SUCH_SONG;
|
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
|
enum playlist_result
|
||||||
@ -125,6 +127,8 @@ playlist::AppendURI(struct player_control &pc,
|
|||||||
enum playlist_result result = AppendSong(pc, song, added_id);
|
enum playlist_result result = AppendSong(pc, song, added_id);
|
||||||
if (db != nullptr)
|
if (db != nullptr)
|
||||||
db->ReturnSong(song);
|
db->ReturnSong(song);
|
||||||
|
else
|
||||||
|
song->Free();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -128,4 +128,6 @@ queue_load_song(TextFile &file, const char *line, queue *queue)
|
|||||||
|
|
||||||
if (db != nullptr)
|
if (db != nullptr)
|
||||||
db->ReturnSong(song);
|
db->ReturnSong(song);
|
||||||
|
else
|
||||||
|
song->Free();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user