summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Huus <eapache@gmail.com>2012-10-08 15:12:45 +0000
committerEvan Huus <eapache@gmail.com>2012-10-08 15:12:45 +0000
commit92c3bc0228b40742c079a03b41f2b25d3e8591d6 (patch)
treef5cce9e6c9c9a76fed70c306f0ce423ccd6db2b2
parent2c181db864e397194a51aff1e7f520264bb30be5 (diff)
downloadwireshark-92c3bc0228b40742c079a03b41f2b25d3e8591d6.tar.gz
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
-rw-r--r--epan/column-utils.c20
-rw-r--r--epan/column-utils.h6
-rw-r--r--ui/gtk/packet_list.c1
3 files changed, 27 insertions, 0 deletions
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 <epan/strutil.h>
#include <epan/epan.h>
+/* 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();