Mercurial > hg > forks > geeqie
changeset 2264:d30109a4e36d
Fix nasty double free crashes
Old GTK+ versions seemed to be robust about this double free so we seen
that crashes or 100% CPU usages just with modern versions.
This patch takes care of it on two places:
1. Hashes will not be freed by g_hash_table_destroy when empty
2. NULLify the enty variable after free
author | Klaus Ethgen <Klaus@Ethgen.de> |
---|---|
date | Mon, 15 Feb 2016 22:09:52 +0100 |
parents | cd32117e507a |
children | 15d51cf8ff3d |
files | src/collect-io.c |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/collect-io.c Tue Feb 02 13:15:49 2016 +0000 +++ b/src/collect-io.c Mon Feb 15 22:09:52 2016 +0100 @@ -497,8 +497,14 @@ collect_manager_action_unref(action); } g_list_free(entry->add_list); - g_hash_table_destroy(entry->oldpath_hash); - g_hash_table_destroy(entry->newpath_hash); + if (g_hash_table_size(entry->oldpath_hash) > 0) + g_hash_table_destroy(entry->oldpath_hash); + else + g_hash_table_unref(entry->oldpath_hash); + if (g_hash_table_size(entry->newpath_hash) > 0) + g_hash_table_destroy(entry->newpath_hash); + else + g_hash_table_unref(entry->newpath_hash); } static void collect_manager_entry_init_data(CollectManagerEntry *entry) @@ -704,6 +710,8 @@ else { collect_manager_entry_free(entry); + + entry = NULL; } } }