aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-12-08 08:06:10 +0100
committerMax Kellermann <max@duempel.org>2009-12-08 08:06:10 +0100
commit23e46b38ca03aa7d83c93df0df51ce5e986b7928 (patch)
tree8bf32be304461f81c4ab54e4a719c387dfaf844d
parent7162fe85ce3008c6bcd2d4b2dfe6505b8a205479 (diff)
downloadmpd-23e46b38ca03aa7d83c93df0df51ce5e986b7928.tar.gz
mpd-23e46b38ca03aa7d83c93df0df51ce5e986b7928.tar.xz
mpd-23e46b38ca03aa7d83c93df0df51ce5e986b7928.zip
mapper: fix memory leak when playlist_directory is not set
Don't allocate the file name before the playlist_dir==NULL check.
-rw-r--r--NEWS1
-rw-r--r--src/mapper.c4
2 files changed, 3 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index c627f6dc3..d8b3714e7 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ ver 0.15.7 (2009/??/??)
- id3: fix ID3v1 charset conversion
* decoders:
- ffmpeg: don't try to force stereo
+* mapper: fix memory leak when playlist_directory is not set
ver 0.15.6 (2009/11/18)
diff --git a/src/mapper.c b/src/mapper.c
index aac7c0c48..5c19021f9 100644
--- a/src/mapper.c
+++ b/src/mapper.c
@@ -221,12 +221,12 @@ map_spl_path(void)
char *
map_spl_utf8_to_fs(const char *name)
{
- char *filename = g_strconcat(name, PLAYLIST_FILE_SUFFIX, NULL);
- char *path;
+ char *filename, *path;
if (playlist_dir == NULL)
return NULL;
+ filename = g_strconcat(name, PLAYLIST_FILE_SUFFIX, NULL);
path = g_build_filename(playlist_dir, filename, NULL);
g_free(filename);