From 92c3bc0228b40742c079a03b41f2b25d3e8591d6 Mon Sep 17 00:00:00 2001 From: Evan Huus Date: Mon, 8 Oct 2012 15:12:45 +0000 Subject: Don't leak all of our column data in packet_list_recreate (I think we still leak some of it?). Maybe part of https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7775 svn path=/trunk/; revision=45388 --- epan/column-utils.c | 20 ++++++++++++++++++++ epan/column-utils.h | 6 ++++++ ui/gtk/packet_list.c | 1 + 3 files changed, 27 insertions(+) diff --git a/epan/column-utils.c b/epan/column-utils.c index 7737ec99dc..5b8354655e 100644 --- a/epan/column-utils.c +++ b/epan/column-utils.c @@ -43,6 +43,26 @@ #include #include +/* Cleanup all the data structures for constructing column data */ +void +col_cleanup(column_info *cinfo) +{ + g_free(cinfo->col_fmt); + g_free(cinfo->fmt_matx); + g_free(cinfo->col_first); + g_free(cinfo->col_last); + g_free(cinfo->col_title); + g_free(cinfo->col_custom_field); + g_free(cinfo->col_custom_occurrence); + g_free(cinfo->col_custom_field_id); + g_free(cinfo->col_custom_dfilter); + g_free(cinfo->col_data); + g_free(cinfo->col_buf); + g_free(cinfo->col_fence); + g_free(cinfo->col_expr.col_expr); + g_free(cinfo->col_expr.col_expr_val); +} + /* Allocate all the data structures for constructing column data, given the number of columns. */ void diff --git a/epan/column-utils.h b/epan/column-utils.h index 51c8e0b657..891d1cf2f8 100644 --- a/epan/column-utils.h +++ b/epan/column-utils.h @@ -39,6 +39,12 @@ extern "C" { * Helper routines for column utility structures and routines. */ +/** Cleanup all the data structures for constructing column data + * + * Internal, don't use this in dissectors! + */ +extern void col_cleanup(column_info *cinfo); + /** Allocate all the data structures for constructing column data, given * the number of columns. * diff --git a/ui/gtk/packet_list.c b/ui/gtk/packet_list.c index c2ac868a75..cc69291010 100644 --- a/ui/gtk/packet_list.c +++ b/ui/gtk/packet_list.c @@ -130,6 +130,7 @@ packet_list_recreate(void) prefs.num_cols = g_list_length(prefs.col_list); + col_cleanup(&cfile.cinfo); build_column_format_array(&cfile.cinfo, prefs.num_cols, FALSE); pkt_scrollw = packet_list_create(); -- cgit v1.2.1