epl: fix memleaks

Fixes a memleak that occurs on (re)loading a pcap. While at it, remove
some unnecessary variables.

Change-Id: Ibb662e5c608881bc7dfde9d12cdb77f699ff6542
Reviewed-on: https://code.wireshark.org/review/17639
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Peter Wu 2016-09-11 17:04:13 +02:00 committed by Michael Mann
parent 5c505e7d43
commit 71c41a0a13
1 changed files with 5 additions and 7 deletions

View File

@ -1576,12 +1576,12 @@ static void
epl_duplication_remove(GHashTable* table, guint8 src, guint8 dest)
{
GHashTableIter iter;
gpointer pkey, pvalue;
gpointer pkey;
duplication_key *key;
g_hash_table_iter_init(&iter, table);
while(g_hash_table_iter_next(&iter, &pkey, &pvalue))
while(g_hash_table_iter_next(&iter, &pkey, NULL))
{
key = (duplication_key *)pkey;
@ -1599,15 +1599,13 @@ epl_duplication_insert(GHashTable* table, gpointer ptr, guint32 frame)
{
duplication_data *data = NULL;
duplication_key *key = NULL;
gpointer pkey = NULL;
gpointer pdata;
/* check if the values are stored */
if(g_hash_table_lookup_extended(table,ptr,&pkey,&pdata))
if(g_hash_table_lookup_extended(table, ptr, NULL, &pdata))
{
data = (duplication_data *)pdata;
data->frame = frame;
g_hash_table_insert(table, pkey, data);
}
/* insert the data struct into the table */
else
@ -1639,10 +1637,9 @@ static guint32
epl_duplication_get(GHashTable* table, gpointer ptr)
{
duplication_data *data = NULL;
gpointer *pkey = NULL;
gpointer pdata;
if(g_hash_table_lookup_extended(table,ptr,pkey,&pdata))
if(g_hash_table_lookup_extended(table, ptr, NULL, &pdata))
{
data = (duplication_data *)pdata;
if(data->frame == 0x00)
@ -1671,6 +1668,7 @@ static void
cleanup_dissector(void)
{
reassembly_table_destroy(&epl_reassembly_table);
g_hash_table_destroy(epl_duplication_table);
count = 0;
ct = 0;
first_read = TRUE;