summaryrefslogtreecommitdiff
path: root/playlist.c
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <waker@users.sourceforge.net>2014-01-20 21:53:25 +0100
committerGravatar Alexey Yakovenko <waker@users.sourceforge.net>2014-01-20 21:53:25 +0100
commit01aaf80f8dbfddd58399114ee27e261d5c601c59 (patch)
treeb83c11cb5055d850b13a1275253d3327687e7b00 /playlist.c
parent96a1dbc5c984f51f42ff6b7bea51ed73a39d061f (diff)
fixed playlist loaders refcounting bug
Diffstat (limited to 'playlist.c')
-rw-r--r--playlist.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/playlist.c b/playlist.c
index 4aa4fab6..27330ca7 100644
--- a/playlist.c
+++ b/playlist.c
@@ -2487,6 +2487,9 @@ plt_load_int (int visibility, playlist_t *plt, playItem_t *after, const char *fn
fclose (fp);
}
trace ("plt_load: success\n");
+ if (last_added) {
+ pl_item_unref (last_added);
+ }
return last_added;
load_fail:
plt_clear (plt);
@@ -2494,6 +2497,9 @@ load_fail:
if (fp) {
fclose (fp);
}
+ if (last_added) {
+ pl_item_unref (last_added);
+ }
return last_added;
}
@@ -2522,9 +2528,6 @@ pl_load_all (void) {
playlist_t *plt = plt_get_for_idx (0);
playItem_t *it = plt_load (plt, NULL, defpl, NULL, NULL, NULL);
- if (it) {
- pl_item_unref (it);
- }
plt_unref (plt);
return 0;
}
@@ -2550,9 +2553,6 @@ pl_load_all (void) {
playlist_t *plt = plt_get_curr ();
playItem_t *trk = plt_load (plt, NULL, path, NULL, NULL, NULL);
- if (trk) {
- pl_item_unref (trk);
- }
char conf[100];
snprintf (conf, sizeof (conf), "playlist.cursor.%d", i);
plt->current_row[PL_MAIN] = deadbeef->conf_get_int (conf, -1);