From 13ec77a9fc3af3b0b502820d0b55796c89997896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Valverde?= Date: Thu, 26 Nov 2015 04:44:52 +0000 Subject: Add free_address_wmem() and other extensions to address API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Try to improve 'address' API (to be easier/safer) and also avoid some constness warnings by not overloading the 'data' pointer to store malloc'ed buffers (use private pointer for that instead). Change-Id: I7456516b12c67620ceadac447907c12f5905bd49 Reviewed-on: https://code.wireshark.org/review/13463 Petri-Dish: João Valverde Tested-by: Petri Dish Buildbot Reviewed-by: João Valverde --- epan/conversation_table.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'epan/conversation_table.c') diff --git a/epan/conversation_table.c b/epan/conversation_table.c index 1aaeabc4b3..12b9418663 100644 --- a/epan/conversation_table.c +++ b/epan/conversation_table.c @@ -285,8 +285,8 @@ reset_conversation_table_data(conv_hash_t *ch) guint i; for(i = 0; i < ch->conv_array->len; i++){ conv_item_t *conv = &g_array_index(ch->conv_array, conv_item_t, i); - g_free((gpointer)conv->src_address.data); - g_free((gpointer)conv->dst_address.data); + free_address(&conv->src_address); + free_address(&conv->dst_address); } g_array_free(ch->conv_array, TRUE); @@ -310,7 +310,7 @@ void reset_hostlist_table_data(conv_hash_t *ch) guint i; for(i = 0; i < ch->conv_array->len; i++){ hostlist_talker_t *host = &g_array_index(ch->conv_array, hostlist_talker_t, i); - g_free((gpointer)host->myaddress.data); + free_address(&host->myaddress); } g_array_free(ch->conv_array, TRUE); @@ -769,7 +769,7 @@ add_hostlist_table_data(conv_hash_t *ch, const address *addr, guint32 port, gboo host_key_t existing_key; gpointer talker_idx_hash_val; - existing_key.myaddress = *addr; + copy_address_shallow(&existing_key.myaddress, addr); existing_key.port = port; if (g_hash_table_lookup_extended(ch->hashtable, &existing_key, NULL, &talker_idx_hash_val)) { -- cgit v1.2.1