After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 662544 - Invalid key destroy by "g_hash_table_iter_replace"
Invalid key destroy by "g_hash_table_iter_replace"
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
2.30.x
Other Linux
: Normal major
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2011-10-23 19:34 UTC by brumikey
Modified: 2011-10-24 17:29 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix g_hash_table_iter_replace (4.32 KB, patch)
2011-10-24 17:29 UTC, Matthias Clasen
committed Details | Review

Description brumikey 2011-10-23 19:34:22 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".
Comment 1 Matthias Clasen 2011-10-24 17:29:38 UTC
The following fix has been pushed:
73e3c98 Fix g_hash_table_iter_replace
Comment 2 Matthias Clasen 2011-10-24 17:29:40 UTC
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.