aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-09-24 10:17:58 +0200
committerMax Kellermann <max@duempel.org>2009-09-24 10:17:58 +0200
commitaec18c74ec63de707b35f126bcdb9ed726ec3a22 (patch)
tree70be739186bbf16552d8ebc4455c42cc7115a791 /src
parent4729d10bb212c9dbcbdd6ac921e4fc824a5f00ec (diff)
downloadmpd-aec18c74ec63de707b35f126bcdb9ed726ec3a22.tar.gz
mpd-aec18c74ec63de707b35f126bcdb9ed726ec3a22.tar.xz
mpd-aec18c74ec63de707b35f126bcdb9ed726ec3a22.zip
decoder/sidplay: free songlength data blob in error handler
When parsing the songlength database fails, the code forgot to free the memory allocated by the raw file data.
Diffstat (limited to 'src')
-rw-r--r--src/decoder/sidplay_plugin.cxx7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/decoder/sidplay_plugin.cxx b/src/decoder/sidplay_plugin.cxx
index b182a732d..9988b15a8 100644
--- a/src/decoder/sidplay_plugin.cxx
+++ b/src/decoder/sidplay_plugin.cxx
@@ -61,8 +61,10 @@ sidplay_load_songlength_db(const char *path)
data[i] = '#';
GKeyFile *db = g_key_file_new();
- if (!g_key_file_load_from_data(db, data, size,
- G_KEY_FILE_NONE, &error)) {
+ bool success = g_key_file_load_from_data(db, data, size,
+ G_KEY_FILE_NONE, &error);
+ g_free(data);
+ if (!success) {
g_warning("unable to parse songlengths file %s: %s",
path, error->message);
g_error_free(error);
@@ -71,7 +73,6 @@ sidplay_load_songlength_db(const char *path)
}
g_key_file_set_list_separator(db, ' ');
- g_free(data);
return db;
}