From 002eaf676642e3df01b98d2d495c2aff30573553 Mon Sep 17 00:00:00 2001 From: waker Date: Thu, 29 Dec 2011 12:03:47 +0100 Subject: fixed filehandle leak in plt_load; fixed error when loading playlist from URI --- playlist.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'playlist.c') diff --git a/playlist.c b/playlist.c index fc1cd4bb..b1c9d319 100644 --- a/playlist.c +++ b/playlist.c @@ -2107,15 +2107,10 @@ pl_save_all (void) { playItem_t * plt_load (playlist_t *plt, playItem_t *after, const char *fname, int *pabort, int (*cb)(playItem_t *it, void *data), void *user_data) { - FILE *fp = fopen (fname, "rb"); - if (!fp) { - trace ("plt_load: failed to open %s\n", fname); - return NULL; - } - // try plugins 1st const char *ext = strrchr (fname, '.'); if (ext) { + trace ("finding playlist plugin for %s\n", ext); ext++; DB_playlist_t **plug = plug_get_playlist_list (); int p, e; @@ -2129,6 +2124,12 @@ plt_load (playlist_t *plt, playItem_t *after, const char *fname, int *pabort, in } } trace ("plt_load: loading dbpl\n"); + FILE *fp = fopen (fname, "rb"); + if (!fp) { + trace ("plt_load: failed to open %s\n", fname); + return NULL; + } + uint8_t majorver; uint8_t minorver; -- cgit v1.2.3