diff options
author | Eric Wong <normalperson@yhbt.net> | 2008-01-26 22:16:24 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-01-26 22:16:24 +0000 |
commit | 06326d66422018151205843907ed5d9ec662f0c4 (patch) | |
tree | e8860a01e2d5853912211c1b923773f384ae87a5 /src/storedPlaylist.c | |
parent | f775e86ca061d947114c83901e973890d8e32a4f (diff) | |
download | mpd-06326d66422018151205843907ed5d9ec662f0c4.tar.gz mpd-06326d66422018151205843907ed5d9ec662f0c4.tar.xz mpd-06326d66422018151205843907ed5d9ec662f0c4.zip |
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
Diffstat (limited to 'src/storedPlaylist.c')
-rw-r--r-- | src/storedPlaylist.c | 12 |
1 files changed, 10 insertions, 2 deletions
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; |