aboutsummaryrefslogtreecommitdiffstats
path: root/epan/conversation.c
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2014-07-07 23:55:54 +0200
committerEvan Huus <eapache@gmail.com>2014-07-08 03:46:04 +0000
commit8fbc0db7d2cc4c040d9cba7623a463e093a9ce5a (patch)
tree5316febe3861515823210258c3d99c6a7bdcc668 /epan/conversation.c
parent9b4f16a2041fec02e44cc14def5f3f7e2fde712b (diff)
conversion: do not free conversation memory on updates
In commit 4afd70d ("Use g_hash_table_new_full to free some values"), the hashtable gained a destroy handler which frees memory. This inadvertently destroyed a conversation during key updates. Fix this by not calling _remove (and thereby calling the destroy handler), but use _steal instead. (Suggestion by Evan Huus). Bug: 10263 Change-Id: I9fa7f5a697599f42894d38718b00b9c0c1b57004 Reviewed-on: https://code.wireshark.org/review/2924 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Evan Huus <eapache@gmail.com>
Diffstat (limited to 'epan/conversation.c')
-rw-r--r--epan/conversation.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/epan/conversation.c b/epan/conversation.c
index 44666b3656..b68da789ea 100644
--- a/epan/conversation.c
+++ b/epan/conversation.c
@@ -609,8 +609,12 @@ conversation_remove_from_hashtable(GHashTable *hashtable, conversation_t *conv)
if (conv == chain_head) {
/* We are currently the front of the chain */
if (NULL == conv->next) {
- /* We are the only conversation in the chain */
- g_hash_table_remove(hashtable, conv->key_ptr);
+ /* We are the only conversation in the chain, no need to
+ * update next pointer, but do not call
+ * g_hash_table_remove() either because the conv data
+ * will be re-inserted. The memory is released when
+ * conversion_cleanup() is called. */
+ g_hash_table_steal(hashtable, conv->key_ptr);
}
else {
/* Update the head of the chain */