aboutsummaryrefslogtreecommitdiffstats
path: root/ui/gtk/compare_stat.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2015-01-11 19:48:54 -0500
committerMichael Mann <mmann78@netscape.net>2015-01-16 00:37:02 +0000
commite530c899406d2212fb7cb8821d083fb4871ff718 (patch)
tree9bb1ef43a4ed562dfb7a19c4db4ecd17926801a7 /ui/gtk/compare_stat.c
parent7d43836b3ad54073a98926450ff0bca7bc34ddeb (diff)
Replace se alloced memory in compare stat tap.
Also replaced comments mentioning se_alloc memory with wmem_file_scope, since it's more accurate. It seems that many of the TShark stat taps may be leaking memory, because the hash tables created by the taps don't get a chance to be freed. Somewhat academic since TShark exits shortly after displaying any stats, but a leak none the less. Change-Id: I8ceecbd00d65b3442dc02d720b39c2e15aa0c8a6 Reviewed-on: https://code.wireshark.org/review/6557 Reviewed-by: Evan Huus <eapache@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'ui/gtk/compare_stat.c')
-rw-r--r--ui/gtk/compare_stat.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/ui/gtk/compare_stat.c b/ui/gtk/compare_stat.c
index 82c14fc6e7..b947a5500b 100644
--- a/ui/gtk/compare_stat.c
+++ b/ui/gtk/compare_stat.c
@@ -203,8 +203,8 @@ comparestat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, const
}
/* collect all packet infos */
- fInfo=(frame_info*)se_alloc(sizeof(frame_info));
- fInfo->fg=(for_gui*)se_alloc(sizeof(for_gui));
+ fInfo=(frame_info*)g_malloc(sizeof(frame_info));
+ fInfo->fg=(for_gui*)g_malloc(sizeof(for_gui));
fInfo->fg->partner=NULL;
fInfo->fg->count=1;
fInfo->fg->cksum=computed_cksum;
@@ -226,6 +226,15 @@ comparestat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, const
}
}
+static void
+frame_info_free(gpointer data)
+{
+ frame_info *fInfo = (frame_info *)data;
+
+ g_free(fInfo->fg);
+ g_free(fInfo);
+}
+
/* Find equal packets, same IP-Id, count them and make time statistics */
static void
call_foreach_count_ip_id(gpointer key _U_, gpointer value, gpointer arg)
@@ -778,7 +787,7 @@ gtk_comparestat_init(const char *opt_arg, void* userdata _U_)
gtk_box_pack_start(GTK_BOX(vbox), cs->scrolled_win, TRUE, TRUE, 0);
/* create a Hash to count the packets with the same ip.id */
- cs->packet_set=g_hash_table_new(NULL, NULL);
+ cs->packet_set=g_hash_table_new_full(NULL, NULL, NULL, frame_info_free);
error_string=register_tap_listener("ip", cs, filter, 0, comparestat_reset, comparestat_packet, comparestat_draw);
if(error_string){