From 0ad15f88ccf434e8210ca64bc99ceeb24a943eb3 Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Sat, 17 Jan 2015 16:55:46 -0500 Subject: Replace the last of ep_alloc and ep_alloc0 with wmem equivalent. Change-Id: I0338d0acda5e4b9957aad4825ca2cfd6fa506ead Reviewed-on: https://code.wireshark.org/review/6596 Petri-Dish: Michael Mann Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann --- epan/osi-utils.c | 6 +++--- epan/osi-utils.h | 2 +- epan/proto.c | 16 +++++++--------- epan/to_str.c | 2 +- 4 files changed, 12 insertions(+), 14 deletions(-) (limited to 'epan') diff --git a/epan/osi-utils.c b/epan/osi-utils.c index fd79510107..00cdba13df 100644 --- a/epan/osi-utils.c +++ b/epan/osi-utils.c @@ -79,11 +79,11 @@ print_nsap_net_buf( const guint8 *ad, int length, gchar *buf, int buf_len) } /* print_nsap */ gchar * -print_system_id( const guint8 *ad, int length ) +print_system_id(wmem_allocator_t* scope, const guint8 *ad, int length ) { gchar *cur; - cur = (gchar *)ep_alloc(MAX_SYSTEMID_LEN * 3 + 5); + cur = (gchar *)wmem_alloc(scope, MAX_SYSTEMID_LEN * 3 + 5); print_system_id_buf(ad, length, cur, MAX_SYSTEMID_LEN * 3 + 5); return( cur ); } @@ -91,7 +91,7 @@ print_system_id( const guint8 *ad, int length ) gchar * tvb_print_system_id( tvbuff_t *tvb, const gint offset, int length ) { - return( print_system_id(tvb_get_ptr(tvb, offset, length), length) ); + return( print_system_id(wmem_packet_scope(), tvb_get_ptr(tvb, offset, length), length) ); } void diff --git a/epan/osi-utils.h b/epan/osi-utils.h index 023438cfc8..1dd02e31bd 100644 --- a/epan/osi-utils.h +++ b/epan/osi-utils.h @@ -49,7 +49,7 @@ gchar* print_nsap_net ( const guint8 *, int ); void print_nsap_net_buf( const guint8 *, int, gchar *, int); gchar* print_area ( const guint8 *, int ); void print_area_buf ( const guint8 *, int, gchar *, int); -gchar* print_system_id( const guint8 *, int ); +gchar* print_system_id(wmem_allocator_t *, const guint8 *, int ); gchar* tvb_print_system_id( tvbuff_t *, const gint, int ); void print_system_id_buf( const guint8 *, int, gchar *, int); diff --git a/epan/proto.c b/epan/proto.c index 328639e04d..ead5f05a24 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -4412,11 +4412,9 @@ proto_custom_set(proto_tree* tree, GSList *field_ids, gint occurrence, break; case FT_GUID: - { str = guid_to_str(NULL, (e_guid_t *)fvalue_get(&finfo->value)); offset_r += protoo_strlcpy(result+offset_r, str, size-offset_r); wmem_free(NULL, str); - } break; case FT_REL_OID: @@ -4443,12 +4441,10 @@ proto_custom_set(proto_tree* tree, GSList *field_ids, gint occurrence, case FT_SYSTEM_ID: bytes = (guint8 *)fvalue_get(&finfo->value); - offset_r += protoo_strlcpy(result+offset_r, - print_system_id(bytes, fvalue_length(&finfo->value)), - size-offset_r); - offset_e += protoo_strlcpy(expr+offset_e, - print_system_id(bytes, fvalue_length(&finfo->value)), - size-offset_e); + str = print_system_id(NULL, bytes, fvalue_length(&finfo->value)); + offset_r += protoo_strlcpy(result+offset_r, str, size-offset_r); + offset_e += protoo_strlcpy(expr+offset_e, str, size-offset_e); + wmem_free(NULL, str); break; case FT_FLOAT: @@ -6236,7 +6232,9 @@ proto_item_fill_label(field_info *fi, gchar *label_str) case FT_SYSTEM_ID: bytes = (guint8 *)fvalue_get(&fi->value); - label_fill(label_str, 0, hfinfo, print_system_id(bytes, fvalue_length(&fi->value))); + tmp = print_system_id(NULL, bytes, fvalue_length(&fi->value)); + label_fill(label_str, 0, hfinfo, tmp); + wmem_free(NULL, tmp); break; case FT_EUI64: diff --git a/epan/to_str.c b/epan/to_str.c index 9ef29fe01d..e56381e4db 100644 --- a/epan/to_str.c +++ b/epan/to_str.c @@ -891,7 +891,7 @@ decode_bits_in_field(const guint bit_offset, const gint no_of_bits, const guint6 mask = mask << (no_of_bits-1); /* Prepare the string, 256 pos for the bits and zero termination, + 64 for the spaces */ - str=(char *)ep_alloc0(256+64); + str=(char *)wmem_alloc0(wmem_packet_scope(), 256+64); for(bit=0;bit<((int)(bit_offset&0x07));bit++){ if(bit&&(!(bit%4))){ str[str_p] = ' '; -- cgit v1.2.1