From 923d2c966f2b8a3582156467ad46ea8d200b30f1 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 4 Jan 2009 18:59:47 +0100 Subject: mapper: allocate the result of map_fs_to_utf8() --- src/mapper.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/mapper.c') diff --git a/src/mapper.c b/src/mapper.c index bd19af615..06780588d 100644 --- a/src/mapper.c +++ b/src/mapper.c @@ -142,9 +142,11 @@ map_song_fs(const struct song *song) return g_strdup(utf8_to_fs_charset(buffer, song->url)); } -const char * -map_fs_to_utf8(const char *path_fs, char *buffer) +char * +map_fs_to_utf8(const char *path_fs) { + char buffer[MPD_PATH_MAX]; + if (strncmp(path_fs, music_dir, music_dir_length) == 0 && path_fs[music_dir_length] == '/') /* remove musicDir prefix */ @@ -153,7 +155,7 @@ map_fs_to_utf8(const char *path_fs, char *buffer) /* not within musicDir */ return NULL; - return fs_charset_to_utf8(buffer, path_fs); + return g_strdup(fs_charset_to_utf8(buffer, path_fs)); } const char * -- cgit v1.2.3