aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-01-01 19:17:44 +0100
committerMax Kellermann <max@duempel.org>2009-01-01 19:17:44 +0100
commit80fa9183e4d30643b1e089d9b96f36a4b266276e (patch)
treeefaa0e4579cb5b7fc6da6610f3485072f384c609 /src/playlist.c
parent886ed1b225d50e5e6c220e11b5800f45d36a5d37 (diff)
downloadmpd-80fa9183e4d30643b1e089d9b96f36a4b266276e.tar.gz
mpd-80fa9183e4d30643b1e089d9b96f36a4b266276e.tar.xz
mpd-80fa9183e4d30643b1e089d9b96f36a4b266276e.zip
mapper: allocate playlist path from heap
Don't pass a static buffer to map_spl_utf8_to_fs().
Diffstat (limited to '')
-rw-r--r--src/playlist.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/playlist.c b/src/playlist.c
index 59a2a0dee..0c93f92b0 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -1203,17 +1203,19 @@ enum playlist_result savePlaylist(const char *utf8file)
{
FILE *fp;
struct stat sb;
- char path_max_tmp[MPD_PATH_MAX];
- const char *path;
+ char *path;
if (!is_valid_playlist_name(utf8file))
return PLAYLIST_RESULT_BAD_NAME;
- path = map_spl_utf8_to_fs(utf8file, path_max_tmp);
- if (!stat(path, &sb))
+ path = map_spl_utf8_to_fs(utf8file);
+ if (!stat(path, &sb)) {
+ g_free(path);
return PLAYLIST_RESULT_LIST_EXISTS;
+ }
while (!(fp = fopen(path, "w")) && errno == EINTR);
+ g_free(path);
if (fp == NULL)
return PLAYLIST_RESULT_ERRNO;