Mercurial > audlegacy
changeset 4097:96194518173c
Fix memory leak in read_ini_string() (Bugzilla #24)
author | Jussi Judin <jjudin+audacious@iki.fi> |
---|---|
date | Wed, 19 Dec 2007 00:48:05 -0600 |
parents | e06261511a5d |
children | fe0f7a72facd |
files | src/audacious/util.c |
diffstat | 1 files changed, 8 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/audacious/util.c Wed Dec 19 00:45:41 2007 -0600 +++ b/src/audacious/util.c Wed Dec 19 00:48:05 2007 -0600 @@ -607,13 +607,16 @@ strip_lower_string(key_string); section_hash = GINT_TO_POINTER(g_string_hash(section_string)); key_hash = GINT_TO_POINTER(g_string_hash(key_string)); - g_string_free(section_string, FALSE); - g_string_free(key_string, FALSE); + section_table = g_hash_table_lookup(inifile, section_hash); - section_table = g_hash_table_lookup(inifile, section_hash); - g_return_val_if_fail(section_table, NULL); + if (section_table) { + value = g_hash_table_lookup(section_table, GINT_TO_POINTER(key_hash)); + } - value = g_hash_table_lookup(section_table, GINT_TO_POINTER(key_hash)); + g_string_free(section_string, TRUE); + g_string_free(key_string, TRUE); + + g_return_val_if_fail(value, NULL); return value; }