diff options
author | Max Kellermann <max@duempel.org> | 2009-01-02 10:48:55 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-01-02 10:48:55 +0100 |
commit | daf7c3db5aac09a8376f1c8ed499eb17202f77a9 (patch) | |
tree | ca912c4ff8c7985431a7e99cb3ea5a9393e09c2a /src/song.c | |
parent | 72255d580e23405375562160bf05fb55d3248f39 (diff) | |
download | mpd-daf7c3db5aac09a8376f1c8ed499eb17202f77a9.tar.gz mpd-daf7c3db5aac09a8376f1c8ed499eb17202f77a9.tar.xz mpd-daf7c3db5aac09a8376f1c8ed499eb17202f77a9.zip |
mapper: allocate the result of map_directory_child_fs(), map_song_fs()
Don't use fixed stack buffers.
Diffstat (limited to 'src/song.c')
-rw-r--r-- | src/song.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/song.c b/src/song.c index b7a8d2f8a..4d93073a9 100644 --- a/src/song.c +++ b/src/song.c @@ -104,15 +104,14 @@ song_free(struct song *song) bool song_file_update(struct song *song) { - char buffer[MPD_PATH_MAX]; - const char *path_fs; + char *path_fs; const struct decoder_plugin *plugin; unsigned int next = 0; struct stat st; assert(song_is_file(song)); - path_fs = map_song_fs(song, buffer); + path_fs = map_song_fs(song); if (path_fs == NULL) return false; @@ -121,8 +120,10 @@ song_file_update(struct song *song) song->tag = NULL; } - if (stat(path_fs, &st) < 0 || !S_ISREG(st.st_mode)) + if (stat(path_fs, &st) < 0 || !S_ISREG(st.st_mode)) { + g_free(path_fs); return false; + } song->mtime = st.st_mtime; @@ -130,19 +131,19 @@ song_file_update(struct song *song) (plugin = hasMusicSuffix(path_fs, next++))) song->tag = plugin->tag_dup(path_fs); + g_free(path_fs); return song->tag != NULL; } bool song_file_update_inarchive(struct song *song) { - char buffer[MPD_PATH_MAX]; - const char *path_fs; + char *path_fs; const struct decoder_plugin *plugin; assert(song_is_file(song)); - path_fs = map_song_fs(song, buffer); + path_fs = map_song_fs(song); if (path_fs == NULL) return false; @@ -154,6 +155,7 @@ song_file_update_inarchive(struct song *song) //because we dont support tag reading throught //input streams plugin = hasMusicSuffix(path_fs, 0); + g_free(path_fs); if (plugin) { song->tag = tag_new(); //tag_add_item(tag, TAG_ITEM_TITLE, f->title); |