From 06326d66422018151205843907ed5d9ec662f0c4 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 26 Jan 2008 22:16:24 +0000 Subject: storedPlaylist: avoid segfaulting with "/" in the path A different, cleaner fix was used in trunk. git-svn-id: https://svn.musicpd.org/mpd/branches/branch-0.13.0-fixes@7156 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/storedPlaylist.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/storedPlaylist.c b/src/storedPlaylist.c index 322cb1b5b..32e22cc4a 100644 --- a/src/storedPlaylist.c +++ b/src/storedPlaylist.c @@ -461,11 +461,19 @@ int renameStoredPlaylist(int fd, const char *utf8from, const char *utf8to) char *to; int ret = 0; - from = xstrdup(utf8pathToFsPathInStoredPlaylist(utf8from, fd)); + from = utf8pathToFsPathInStoredPlaylist(utf8from, fd); + if (!from) + return -1; + from = xstrdup(from); if (!from) return -1; - to = xstrdup(utf8pathToFsPathInStoredPlaylist(utf8to, fd)); + to = utf8pathToFsPathInStoredPlaylist(utf8to, fd); + if (!to) { + free(from); + return -1; + } + to = xstrdup(to); if (!to) { free(from); return -1; -- cgit v1.2.3