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>
This commit is contained in:
Michael Mann 2017-01-29 22:00:39 -05:00
parent d802b5b0ec
commit ad5cb2eb72
2 changed files with 6 additions and 4 deletions

View File

@ -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);
}
/*

View File

@ -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);