aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2010-05-31 10:24:08 +0200
committerMax Kellermann <max@duempel.org>2010-05-31 10:24:08 +0200
commitde8f2739c2977ffb042bfd9c36630fe6f187901f (patch)
treebbc6eee1359f9edb770fddbd52575d7c0412167e
parent2c1c5888683197dba3477487ca49727fd48fbac6 (diff)
downloadmpd-de8f2739c2977ffb042bfd9c36630fe6f187901f.tar.gz
mpd-de8f2739c2977ffb042bfd9c36630fe6f187901f.tar.xz
mpd-de8f2739c2977ffb042bfd9c36630fe6f187901f.zip
decoder/mikmod: fix memory leak
The return value of Player_LoadTitle() is allocated with malloc(), and must be freed by the caller.
-rw-r--r--NEWS1
-rw-r--r--src/decoder/mikmod_decoder_plugin.c6
2 files changed, 5 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 510f257f3..b5b6e91ab 100644
--- a/NEWS
+++ b/NEWS
@@ -39,6 +39,7 @@ ver 0.16 (20??/??/??)
- wavpack: allow more than 2 channels
- mp4ff: rename plugin "mp4" to "mp4ff"
- mp4ff: support tags "albumartist", "band"
+ - mikmod: fix memory leak
* encoders:
- twolame: new encoder plugin based on libtwolame
- flac: new encoder plugin based on libFLAC
diff --git a/src/decoder/mikmod_decoder_plugin.c b/src/decoder/mikmod_decoder_plugin.c
index 5cbfa23dd..50b46f2af 100644
--- a/src/decoder/mikmod_decoder_plugin.c
+++ b/src/decoder/mikmod_decoder_plugin.c
@@ -195,11 +195,13 @@ mikmod_decoder_tag_dup(const char *path_fs)
tag->time = 0;
- char *title = g_strdup(Player_LoadTitle(path2));
+ char *title = Player_LoadTitle(path2);
g_free(path2);
- if (title)
+ if (title != NULL) {
tag_add_item(tag, TAG_TITLE, title);
+ free(title);
+ }
return tag;
}