diff options
author | Max Kellermann <max@duempel.org> | 2009-01-02 10:48:11 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-01-02 10:48:11 +0100 |
commit | 72255d580e23405375562160bf05fb55d3248f39 (patch) | |
tree | 3730bdf7d0847b01f291c9ced0dc30856b45a26b /src/playlist_save.c | |
parent | b2e3b644838bec1877bca9999569e0f82951ec1f (diff) | |
download | mpd-72255d580e23405375562160bf05fb55d3248f39.tar.gz mpd-72255d580e23405375562160bf05fb55d3248f39.tar.xz mpd-72255d580e23405375562160bf05fb55d3248f39.zip |
mapper: allocate the result of map_uri_fs(), map_directory_fs()
Don't use fixed stack buffers.
Diffstat (limited to '')
-rw-r--r-- | src/playlist_save.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/playlist_save.c b/src/playlist_save.c index b07137d9e..b6bc99369 100644 --- a/src/playlist_save.c +++ b/src/playlist_save.c @@ -24,6 +24,8 @@ #include "ls.h" #include "database.h" +#include <glib.h> + void playlist_print_song(FILE *file, const struct song *song) { @@ -44,14 +46,16 @@ void playlist_print_uri(FILE *file, const char *uri) { char tmp[MPD_PATH_MAX]; - const char *s; + char *s; if (playlist_saveAbsolutePaths && !isRemoteUrl(uri) && uri[0] != '/') - s = map_uri_fs(uri, tmp); + s = map_uri_fs(uri); else - s = utf8_to_fs_charset(tmp, uri); + s = g_strdup(utf8_to_fs_charset(tmp, uri)); - if (s != NULL) + if (s != NULL) { fprintf(file, "%s\n", s); + g_free(s); + } } |