GNOME Bugzilla – Bug 662544
Invalid key destroy by "g_hash_table_iter_replace"
Last modified: 2011-10-24 17:29:40 UTC
The function "g_hash_table_iter_replace" is calling "g_hash_table_insert_node" with the same key pointer as is currently in the hash table. The function "g_hash_table_insert_node" assumes this to not be the case and if "hash_table->key_destroy_func" is set, the memory will be destroyed. Now this leaves the key pointing to invalid memory. The key should not be destroyed when calling "g_hash_table_iter_replace".
The following fix has been pushed: 73e3c98 Fix g_hash_table_iter_replace
Created attachment 199850 [details] [review] Fix g_hash_table_iter_replace When reusing an existing key 'internally', we must avoid calling the key_destroy function on the old key.