From f789c91a5ebbbefba51aa3da983fe836ebc860d6 Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Sun, 29 Jan 2017 18:51:00 -0500 Subject: Have format_text_wsp use wmem allocated memory. format_text_wsp is fed into by tvb_format_text_wsp and tvb_format_stringzpad_wsp so those functions need to add a wmem allocated parameter as well. Most of the changes came from tvb_format_text_wsp and tvb_format_stringzpad_wsp being changed more so than format_text_wsp. Change-Id: I52214ca107016f0e96371a9a8430aa89336f91d7 Reviewed-on: https://code.wireshark.org/review/19851 Petri-Dish: Michael Mann Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann --- epan/proto.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'epan/proto.c') diff --git a/epan/proto.c b/epan/proto.c index d42ac90a7a..42c0227ba0 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -1338,6 +1338,7 @@ proto_tree_add_format_wsp_text(proto_tree *tree, tvbuff_t *tvb, gint start, gint { proto_item *pi; header_field_info *hfinfo; + gchar* str; CHECK_FOR_NULL_TREE(tree); @@ -1347,7 +1348,9 @@ proto_tree_add_format_wsp_text(proto_tree *tree, tvbuff_t *tvb, gint start, gint TRY_TO_FAKE_THIS_REPR(pi); - proto_item_set_text(pi, "%s", tvb_format_text_wsp(tvb, start, length)); + str = tvb_format_text_wsp(NULL, tvb, start, length); + proto_item_set_text(pi, "%s", str); + wmem_free(NULL, str); return pi; } -- cgit v1.2.1