From 80fa9183e4d30643b1e089d9b96f36a4b266276e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 1 Jan 2009 19:17:44 +0100 Subject: mapper: allocate playlist path from heap Don't pass a static buffer to map_spl_utf8_to_fs(). --- src/playlist.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/playlist.c') 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; -- cgit v1.2.3