summaryrefslogtreecommitdiff
path: root/epan/tvbuff.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2017-01-29 22:00:39 -0500
committerMichael Mann <mmann78@netscape.net>2017-01-31 02:28:01 +0000
commitad5cb2eb72996c28bcd3e8f421e6dd410841e647 (patch)
tree2839bf102a24bbe50936fff415c77469461d0712 /epan/tvbuff.c
parentd802b5b0ec8e10fbf64f6c76815b759323029bb4 (diff)
downloadwireshark-ad5cb2eb72996c28bcd3e8f421e6dd410841e647.tar.gz
Have tvb_format_stringzpad use wmem_packet_scope() memory.
It's only use is in dissectors, so have it use format_text_wmem with wmem_packet_scope(). Change-Id: I22121324fd47aee32174b65104458ad2ef329bd7 Reviewed-on: https://code.wireshark.org/review/19856 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/tvbuff.c')
-rw-r--r--epan/tvbuff.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/epan/tvbuff.c b/epan/tvbuff.c
index 2d95e173f8..725fdffa53 100644
--- a/epan/tvbuff.c
+++ b/epan/tvbuff.c
@@ -2201,9 +2201,10 @@ tvb_format_text_wsp(wmem_allocator_t* allocator, tvbuff_t *tvb, const gint offse
return format_text_wsp(allocator, ptr, len);
}
-/*
+/**
* Like "tvb_format_text()", but for null-padded strings; don't show
- * the null padding characters as "\000".
+ * the null padding characters as "\000". Returned string is wmem packet_scoped
+ * so call must be in that scope.
*/
gchar *
tvb_format_stringzpad(tvbuff_t *tvb, const gint offset, const gint size)
@@ -2217,7 +2218,7 @@ tvb_format_stringzpad(tvbuff_t *tvb, const gint offset, const gint size)
ptr = ensure_contiguous(tvb, offset, size);
for (p = ptr, stringlen = 0; stringlen < len && *p != '\0'; p++, stringlen++)
;
- return format_text(ptr, stringlen);
+ return format_text_wmem(wmem_packet_scope(), ptr, stringlen);
}
/*