diff options
-rw-r--r-- | epan/tvbuff.c | 7 | ||||
-rw-r--r-- | epan/tvbuff.h | 3 |
2 files changed, 6 insertions, 4 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); } /* diff --git a/epan/tvbuff.h b/epan/tvbuff.h index 3023655bff..95cf6cc17b 100644 --- a/epan/tvbuff.h +++ b/epan/tvbuff.h @@ -550,7 +550,8 @@ WS_DLL_PUBLIC gchar *tvb_format_text_wsp(wmem_allocator_t* allocator, tvbuff_t * /** * 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. */ extern gchar *tvb_format_stringzpad(tvbuff_t *tvb, const gint offset, const gint size); |