aboutsummaryrefslogtreecommitdiffstats
path: root/epan/conversation.c
diff options
context:
space:
mode:
authorEvan Huus <eapache@gmail.com>2014-07-06 09:21:25 -0400
committerAnders Broman <a.broman58@gmail.com>2014-07-06 14:27:27 +0000
commit4afd70d4e46c944e5d4e9476103992e621510253 (patch)
tree0d33d638c96fc5c251edf286ad728a0a1732704d /epan/conversation.c
parent6318a29fa367f118994d689e2a6ac2198bc6e582 (diff)
Use g_hash_table_new_full to free some values
Fixes a good 80-90KB of leaks in certain cases. Bug: 10261 Change-Id: I81d57ac67219e730b03649b9fdfc2306807bdb97 Reviewed-on: https://code.wireshark.org/review/2879 Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/conversation.c')
-rw-r--r--epan/conversation.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/epan/conversation.c b/epan/conversation.c
index 52d8ee18e0..44666b3656 100644
--- a/epan/conversation.c
+++ b/epan/conversation.c
@@ -461,7 +461,7 @@ conversation_match_no_addr2_or_port2(gconstpointer v, gconstpointer w)
* Free the proto_data. The conversation itself is se_allocated.
*/
static void
-free_data_list(gpointer key _U_, gpointer value, gpointer user_data _U_)
+free_data_list(gpointer value)
{
conversation_t *conv = (conversation_t *)value;
@@ -485,19 +485,15 @@ conversation_cleanup(void)
*/
conversation_keys = NULL;
if (conversation_hashtable_exact != NULL) {
- g_hash_table_foreach(conversation_hashtable_exact, free_data_list, NULL);
g_hash_table_destroy(conversation_hashtable_exact);
}
if (conversation_hashtable_no_addr2 != NULL) {
- g_hash_table_foreach(conversation_hashtable_no_addr2, free_data_list, NULL);
g_hash_table_destroy(conversation_hashtable_no_addr2);
}
if (conversation_hashtable_no_port2 != NULL) {
- g_hash_table_foreach(conversation_hashtable_no_port2, free_data_list, NULL);
g_hash_table_destroy(conversation_hashtable_no_port2);
}
if (conversation_hashtable_no_addr2_or_port2 != NULL) {
- g_hash_table_foreach(conversation_hashtable_no_addr2_or_port2, free_data_list, NULL);
g_hash_table_destroy(conversation_hashtable_no_addr2_or_port2);
}
@@ -523,17 +519,17 @@ conversation_init(void)
* above.
*/
conversation_hashtable_exact =
- g_hash_table_new(conversation_hash_exact,
- conversation_match_exact);
+ g_hash_table_new_full(conversation_hash_exact,
+ conversation_match_exact, NULL, free_data_list);
conversation_hashtable_no_addr2 =
- g_hash_table_new(conversation_hash_no_addr2,
- conversation_match_no_addr2);
+ g_hash_table_new_full(conversation_hash_no_addr2,
+ conversation_match_no_addr2, NULL, free_data_list);
conversation_hashtable_no_port2 =
- g_hash_table_new(conversation_hash_no_port2,
- conversation_match_no_port2);
+ g_hash_table_new_full(conversation_hash_no_port2,
+ conversation_match_no_port2, NULL, free_data_list);
conversation_hashtable_no_addr2_or_port2 =
- g_hash_table_new(conversation_hash_no_addr2_or_port2,
- conversation_match_no_addr2_or_port2);
+ g_hash_table_new_full(conversation_hash_no_addr2_or_port2,
+ conversation_match_no_addr2_or_port2, NULL, free_data_list);
/*
* Start the conversation indices over at 0.