aboutsummaryrefslogtreecommitdiffstats
path: root/epan/conversation.c
diff options
context:
space:
mode:
authorJeff Morriss <jeff.morriss@ulticom.com>2011-10-20 02:29:13 +0000
committerJeff Morriss <jeff.morriss@ulticom.com>2011-10-20 02:29:13 +0000
commitab7ec88be559a78e696ab98d8a692bbf64746fbd (patch)
tree3dda94e29ab84115d30f53221b053afd7a4b4873 /epan/conversation.c
parentdb8bf387c898e97ff95a08fb990b3280b310d7a7 (diff)
Delay freeing of seasonal memory until after the conversation cleanup routine
has been called. In the conversation cleanup routine, free the GSlist for any proto_data which may have been hanging off the (se_allocated) conversation. svn path=/trunk/; revision=39484
Diffstat (limited to 'epan/conversation.c')
-rw-r--r--epan/conversation.c37
1 files changed, 32 insertions, 5 deletions
diff --git a/epan/conversation.c b/epan/conversation.c
index 2b2d4b198a..d40ee7677d 100644
--- a/epan/conversation.c
+++ b/epan/conversation.c
@@ -409,21 +409,48 @@ conversation_match_no_addr2_or_port2(gconstpointer v, gconstpointer w)
}
/*
+ * Free the proto_data. The conversation itself is se_allocated.
+ */
+void
+free_data_list(gpointer key _U_, gpointer value, gpointer user_data _U_)
+{
+ conversation_t *conv = value;
+
+ /* TODO: se_slist? */
+ g_slist_free(conv->data_list);
+
+ /* Not really necessary, but... */
+ conv->data_list = NULL;
+
+}
+
+/*
* Destroy all existing conversations
*/
void
conversation_cleanup(void)
{
- /* The conversation keys are se_ allocated so they are already gone */
+ /* Clean up the hash tables, but only after freeing any proto_data
+ * that may be hanging off the conversations.
+ * The conversation keys are se_ allocated so we don't have to clean them up.
+ */
conversation_keys = NULL;
- if (conversation_hashtable_exact != 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)
+ }
+ 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)
+ }
+ 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)
+ }
+ 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);
+ }
conversation_hashtable_exact = NULL;
conversation_hashtable_no_addr2 = NULL;