aboutsummaryrefslogtreecommitdiffstats
path: root/src/mapper.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-01-04 18:59:47 +0100
committerMax Kellermann <max@duempel.org>2009-01-04 18:59:47 +0100
commit923d2c966f2b8a3582156467ad46ea8d200b30f1 (patch)
tree647c54bf4194fbfb190ef24bdc199d7440e85f5a /src/mapper.c
parent8c5470a3db7f36cc50b8f5591c8b1f1410977581 (diff)
downloadmpd-923d2c966f2b8a3582156467ad46ea8d200b30f1.tar.gz
mpd-923d2c966f2b8a3582156467ad46ea8d200b30f1.tar.xz
mpd-923d2c966f2b8a3582156467ad46ea8d200b30f1.zip
mapper: allocate the result of map_fs_to_utf8()
Diffstat (limited to 'src/mapper.c')
-rw-r--r--src/mapper.c8
1 files changed, 5 insertions, 3 deletions
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 *