epan: remove a few more uses of wmem_packet_scope

This commit is contained in:
Evan Huus 2021-08-27 13:10:00 -04:00 committed by Wireshark GitLab Utility
parent eaa2cf0c21
commit 7124525d24
3 changed files with 11 additions and 7 deletions

View File

@ -51,7 +51,7 @@ void asn1_ctx_clean_epdv(asn1_ctx_t *actx) {
void asn1_stack_frame_push(asn1_ctx_t *actx, const gchar *name) {
asn1_stack_frame_t *frame;
frame = wmem_new0(wmem_packet_scope(), asn1_stack_frame_t);
frame = wmem_new0(actx->pinfo->pool, asn1_stack_frame_t);
frame->name = name;
frame->next = actx->stack;
actx->stack = frame;
@ -99,7 +99,7 @@ static asn1_par_t *push_new_par(asn1_ctx_t *actx) {
DISSECTOR_ASSERT(actx->stack);
par = wmem_new0(wmem_packet_scope(), asn1_par_t);
par = wmem_new0(actx->pinfo->pool, asn1_par_t);
pp = &(actx->stack->par);
while (*pp)

View File

@ -1172,7 +1172,7 @@ get_etsi_ts_102_221_annex_a_string(wmem_allocator_t *scope, const guint8 *ptr,
*/
if (length == 0) {
/* XXX - return error indication */
strbuf = wmem_strbuf_new(wmem_packet_scope(), "");
strbuf = wmem_strbuf_new(scope, "");
return (guint8 *)wmem_strbuf_finalize(strbuf);
}
string_type = *ptr;
@ -1214,14 +1214,14 @@ get_etsi_ts_102_221_annex_a_string(wmem_allocator_t *scope, const guint8 *ptr,
*/
if (length == 0) {
/* XXX - return error indication */
strbuf = wmem_strbuf_new(wmem_packet_scope(), "");
strbuf = wmem_strbuf_new(scope, "");
return (guint8 *)wmem_strbuf_finalize(strbuf);
}
string_len = *ptr;
ptr++;
length--;
strbuf = wmem_strbuf_sized_new(wmem_packet_scope(), 2*string_len+1, 0);
strbuf = wmem_strbuf_sized_new(scope, 2*string_len+1, 0);
/*
* Get the UCS-2 base.

View File

@ -39,8 +39,8 @@ ResolveWin32UUID(e_guid_t if_id, char *uuid_name, int uuid_name_max_len)
DWORD uuid_max_size = MAX_PATH;
TCHAR *reg_uuid_str;
reg_uuid_name=wmem_alloc(wmem_packet_scope(), (MAX_PATH*sizeof(TCHAR))+1);
reg_uuid_str=wmem_alloc(wmem_packet_scope(), (MAX_PATH*sizeof(TCHAR))+1);
reg_uuid_name=wmem_alloc(NULL, (MAX_PATH*sizeof(TCHAR))+1);
reg_uuid_str=wmem_alloc(NULL, (MAX_PATH*sizeof(TCHAR))+1);
if(uuid_name_max_len < 2){
return 0;
@ -56,10 +56,14 @@ ResolveWin32UUID(e_guid_t if_id, char *uuid_name, int uuid_name_max_len)
if (RegQueryValueEx(hKey, NULL, NULL, NULL, (LPBYTE)reg_uuid_name, &uuid_max_size) == ERROR_SUCCESS && uuid_max_size <= MAX_PATH) {
g_snprintf(uuid_name, uuid_name_max_len, "%s", utf_16to8(reg_uuid_name));
RegCloseKey(hKey);
wmem_free(NULL, reg_uuid_name);
wmem_free(NULL, reg_uuid_str);
return (int) strlen(uuid_name);
}
RegCloseKey(hKey);
}
wmem_free(NULL, reg_uuid_name);
wmem_free(NULL, reg_uuid_str);
return 0; /* we didn't find anything anyhow. Please don't use the string! */
}