From 92ff09881a5fa92c25bb768a7c58e341e0964f2f Mon Sep 17 00:00:00 2001 From: "J. Alexander Treuman" Date: Wed, 16 May 2007 20:35:13 +0000 Subject: Fail loading the playlist on errors mid-file. The same code is used for playlistadd, playlistdelete, etc. and would've caused the playlist to be rewritten only up to the line with the error. git-svn-id: https://svn.musicpd.org/mpd/trunk@6133 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/storedPlaylist.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/storedPlaylist.c b/src/storedPlaylist.c index b36bb10a7..75605313f 100644 --- a/src/storedPlaylist.c +++ b/src/storedPlaylist.c @@ -192,6 +192,8 @@ StoredPlaylist *loadStoredPlaylist(const char *utf8path, int fd) ERROR("\"%s\" too long", temp); free(temp); + freeStoredPlaylist(sp); + sp = NULL; goto out; } free(temp); @@ -211,6 +213,8 @@ StoredPlaylist *loadStoredPlaylist(const char *utf8path, int fd) s, utf8path); } ERROR("line \"%s\" in playlist \"%s\" is too long\n", s, utf8path); + freeStoredPlaylist(sp); + sp = NULL; goto out; } else if (s[slength] != '\r') slength++; -- cgit v1.2.3