summaryrefslogtreecommitdiff
path: root/playlist.c
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-02-13 10:51:23 +0100
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-02-13 10:51:23 +0100
commit2ac056580814c151a58307a7b0c236f1912202c9 (patch)
tree61f9eab405d54ccb158488aedf1a9ef0161c8f98 /playlist.c
parenteb09fe0fbb0a4ac90527e0234c9481033bd66abd (diff)
fixed memleak in plt_free/plt_remove
Diffstat (limited to 'playlist.c')
-rw-r--r--playlist.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/playlist.c b/playlist.c
index 28ae51a1..34e737f4 100644
--- a/playlist.c
+++ b/playlist.c
@@ -234,9 +234,7 @@ plt_remove (int plt) {
playlist->title = strdup ("Default");
PLT_UNLOCK;
plt_gen_conf ();
- if (!plt_loading) {
- plug_trigger_event (DB_EV_PLAYLISTSWITCH, 0);
- }
+ plug_trigger_event (DB_EV_PLAYLISTSWITCH, 0);
return;
}
playlist_t *prev = NULL;
@@ -256,6 +254,10 @@ plt_remove (int plt) {
prev->next = p->next;
}
}
+ playlist_t *old = playlist;
+ playlist = p;
+ pl_clear ();
+ playlist = old;
if (p == playlist) {
playlist = prev ? prev : playlists_head;
}
@@ -347,6 +349,7 @@ plt_set_title (int plt, const char *title) {
void
plt_free (void) {
+ trace ("plt_free\n");
PLT_LOCK;
plt_loading = 1;
while (playlists_head) {