From 1dccd1ee072722fbe6d5e1a9d726a7e87d191f76 Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Tue, 10 May 2016 16:04:14 -0400 Subject: Have fvalue_to_string_repr always return an (wmem) allocated buffer. Previous patches converted all fvalue_to_string_repr calls to expect an allocated buffer (and not a passed in one). Now changing signature to force an allocated buffer. Added wmem in case that can be taken advantage of within epan (and since the function signature was changing anyway). Change-Id: Ica1ac4a9a182ce0e73303856329e198d9d525b7b Reviewed-on: https://code.wireshark.org/review/15343 Reviewed-by: Michael Mann --- rawshark.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'rawshark.c') diff --git a/rawshark.c b/rawshark.c index 41ca4ba716..cd59d9fdf9 100644 --- a/rawshark.c +++ b/rawshark.c @@ -1189,9 +1189,8 @@ static gboolean print_field_value(field_info *finfo, int cmd_line_index) * e.g: ip.hdr_len */ fs_len = fvalue_string_repr_len(&finfo->value, FTREPR_DFILTER, finfo->hfinfo->display); - fs_buf = fvalue_to_string_repr(&finfo->value, - FTREPR_DFILTER, finfo->hfinfo->display, - NULL); + fs_buf = fvalue_to_string_repr(NULL, &finfo->value, + FTREPR_DFILTER, finfo->hfinfo->display); fs_ptr = fs_buf; /* String types are quoted. Remove them. */ @@ -1280,14 +1279,14 @@ static gboolean print_field_value(field_info *finfo, int cmd_line_index) } } printf(" %d=\"%s\"", cmd_line_index, label_s->str); - g_free(fs_buf); + wmem_free(NULL, fs_buf); return TRUE; } if(finfo->value.ftype->val_to_string_repr) { printf(" %d=\"%s\"", cmd_line_index, fs_ptr); - g_free(fs_buf); + wmem_free(NULL, fs_buf); return TRUE; } -- cgit v1.2.1