diff --git a/epan/column-utils.c b/epan/column-utils.c index b27c5e791c..5486050a8a 100644 --- a/epan/column-utils.c +++ b/epan/column-utils.c @@ -43,25 +43,6 @@ #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_buf); - g_free(cinfo->col_fence); - g_free((gchar **)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 @@ -91,6 +72,35 @@ col_setup(column_info *cinfo, const gint num_cols) } } +/* Cleanup all the data structures for constructing column data; undoes + the allocations that col_setup() does. */ +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); + /* + * XXX - MSVC doesn't correctly handle the "const" qualifier; it thinks + * "const XXX **" means "pointer to const pointer to XXX", i.e. that + * it's a pointer to something that's "const"ant, not "pointer to + * pointer to const XXX", i.e. that it's a pointer to a pointer to + * something that's "const"ant. Cast its bogus complaints away. + */ + g_free((gchar **)cinfo->col_data); + g_free(cinfo->col_buf); + g_free(cinfo->col_fence); + /* XXX - see above */ + g_free((gchar **)cinfo->col_expr.col_expr); + g_free(cinfo->col_expr.col_expr_val); +} + /* Initialize the data structures for constructing column data. */ void col_init(column_info *cinfo) diff --git a/epan/column-utils.h b/epan/column-utils.h index 891d1cf2f8..9efcd6cf9f 100644 --- a/epan/column-utils.h +++ b/epan/column-utils.h @@ -39,12 +39,6 @@ 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. * @@ -52,6 +46,13 @@ extern void col_cleanup(column_info *cinfo); */ extern void col_setup(column_info *cinfo, const gint num_cols); +/** Cleanup all the data structures for constructing column data; + * undoes the alocations that col_setup() does. + * + * Internal, don't use this in dissectors! + */ +extern void col_cleanup(column_info *cinfo); + /** Initialize the data structures for constructing column data. * * Internal, don't use this in dissectors!