From aec18c74ec63de707b35f126bcdb9ed726ec3a22 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 24 Sep 2009 10:17:58 +0200 Subject: 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. --- src/decoder/sidplay_plugin.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/decoder/sidplay_plugin.cxx') 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; } -- cgit v1.2.3