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>
This commit is contained in:
parent
6318a29fa3
commit
4afd70d4e4
|
@ -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.
|
||||
|
|
|
@ -424,6 +424,14 @@ rpc_prog_hash(gconstpointer k)
|
|||
return (key->prog);
|
||||
}
|
||||
|
||||
static void
|
||||
rpc_prog_free_val(gpointer v)
|
||||
{
|
||||
rpc_prog_info_value *value = (rpc_prog_info_value*)v;
|
||||
|
||||
g_array_free(value->procedure_hfs, TRUE);
|
||||
g_free(value);
|
||||
}
|
||||
|
||||
void
|
||||
rpc_init_prog(int proto, guint32 prog, int ett)
|
||||
|
@ -4033,8 +4041,10 @@ proto_register_rpc(void)
|
|||
* will be called before any handoff registration routines
|
||||
* are called.
|
||||
*/
|
||||
rpc_progs = g_hash_table_new(rpc_prog_hash, rpc_prog_equal);
|
||||
rpc_procs = g_hash_table_new(rpc_proc_hash, rpc_proc_equal);
|
||||
rpc_progs = g_hash_table_new_full(rpc_prog_hash, rpc_prog_equal,
|
||||
g_free, rpc_prog_free_val);
|
||||
rpc_procs = g_hash_table_new_full(rpc_proc_hash, rpc_proc_equal,
|
||||
g_free, g_free);
|
||||
|
||||
authgss_contexts=wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue