diff --git a/epan/dissectors/packet-arp.c b/epan/dissectors/packet-arp.c index cc695c035d..c1cb92f696 100644 --- a/epan/dissectors/packet-arp.c +++ b/epan/dissectors/packet-arp.c @@ -361,20 +361,20 @@ static const value_string atmop_vals[] = { (((ar_pro) == ETHERTYPE_IP || (ar_pro) == AX25_P_IP) && (ar_pln) == 4) const gchar * -tvb_arphrdaddr_to_str(tvbuff_t *tvb, gint offset, int ad_len, guint16 type) +tvb_arphrdaddr_to_str(wmem_allocator_t *scope, tvbuff_t *tvb, gint offset, int ad_len, guint16 type) { if (ad_len == 0) return ""; if (ARP_HW_IS_ETHER(type, ad_len)) { /* Ethernet address (or IEEE 802.x address, which is the same type of address). */ - return tvb_ether_to_str(wmem_packet_scope(), tvb, offset); + return tvb_ether_to_str(scope, tvb, offset); } - return tvb_bytes_to_str(wmem_packet_scope(), tvb, offset, ad_len); + return tvb_bytes_to_str(scope, tvb, offset, ad_len); } static const gchar * -arpproaddr_to_str(const guint8 *ad, int ad_len, guint16 type) +arpproaddr_to_str(wmem_allocator_t *scope, const guint8 *ad, int ad_len, guint16 type) { address addr; @@ -384,27 +384,28 @@ arpproaddr_to_str(const guint8 *ad, int ad_len, guint16 type) /* IPv4 address. */ set_address(&addr, AT_IPv4, 4, ad); - return address_to_str(wmem_packet_scope(), &addr); + return address_to_str(scope, &addr); } if (ARP_HW_IS_AX25(type, ad_len)) { { /* AX.25 address */ set_address(&addr, AT_AX25, AX25_ADDR_LEN, ad); - return address_to_str(wmem_packet_scope(), &addr); + return address_to_str(scope, &addr); } } - return bytes_to_str(wmem_packet_scope(), ad, ad_len); + return bytes_to_str(scope, ad, ad_len); } static const gchar * -tvb_arpproaddr_to_str(tvbuff_t *tvb, gint offset, int ad_len, guint16 type) +tvb_arpproaddr_to_str(wmem_allocator_t *scope, tvbuff_t *tvb, gint offset, int ad_len, guint16 type) { - return arpproaddr_to_str(tvb_get_ptr(tvb, offset, ad_len), ad_len, type); + const guint8 *ad = tvb_memdup(scope, tvb, offset, ad_len); + return arpproaddr_to_str(scope, ad, ad_len, type); } static const gchar * -atmarpnum_to_str(tvbuff_t *tvb, int offset, int ad_tl) +atmarpnum_to_str(wmem_allocator_t *scope, tvbuff_t *tvb, int offset, int ad_tl) { int ad_len = ad_tl & ATMARP_LEN_MASK; @@ -415,19 +416,19 @@ atmarpnum_to_str(tvbuff_t *tvb, int offset, int ad_tl) /* * I'm assuming this means it's an ASCII (IA5) string. */ - return (gchar *) tvb_get_string_enc(wmem_packet_scope(), tvb, offset, ad_len, ENC_ASCII|ENC_NA); + return (gchar *) tvb_get_string_enc(scope, tvb, offset, ad_len, ENC_ASCII|ENC_NA); } else { /* * NSAP. * * XXX - break down into subcomponents. */ - return tvb_bytes_to_str(wmem_packet_scope(), tvb, offset, ad_len); + return tvb_bytes_to_str(scope, tvb, offset, ad_len); } } static const gchar * -atmarpsubaddr_to_str(tvbuff_t *tvb, int offset, int ad_tl) +atmarpsubaddr_to_str(wmem_allocator_t *scope, tvbuff_t *tvb, int offset, int ad_tl) { int ad_len = ad_tl & ATMARP_LEN_MASK; @@ -443,7 +444,7 @@ atmarpsubaddr_to_str(tvbuff_t *tvb, int offset, int ad_tl) * * XXX - break down into subcomponents? */ - return tvb_bytes_to_str(wmem_packet_scope(), tvb, offset, ad_len); + return tvb_bytes_to_str(scope, tvb, offset, ad_len); } const value_string arp_hrd_vals[] = { @@ -746,9 +747,9 @@ check_for_duplicate_addresses(packet_info *pinfo, proto_tree *tree, /* Create subtree */ duplicate_tree = proto_tree_add_subtree_format(tree, tvb, 0, 0, ett_arp_duplicate_address, &ti, "Duplicate IP address detected for %s (%s) - also in use by %s (frame %u)", - arpproaddr_to_str((guint8*)&ip, 4, ETHERTYPE_IP), - address_to_str(wmem_packet_scope(), &mac_addr), - address_to_str(wmem_packet_scope(), &result_mac_addr), + arpproaddr_to_str(pinfo->pool, (guint8*)&ip, 4, ETHERTYPE_IP), + address_to_str(pinfo->pool, &mac_addr), + address_to_str(pinfo->pool, &result_mac_addr), result->frame_num); proto_item_set_generated(ti); @@ -759,7 +760,7 @@ check_for_duplicate_addresses(packet_info *pinfo, proto_tree *tree, expert_add_info_format(pinfo, ti, &ei_seq_arp_dup_ip, "Duplicate IP address configured (%s)", - arpproaddr_to_str((guint8*)&ip, 4, ETHERTYPE_IP)); + arpproaddr_to_str(pinfo->pool, (guint8*)&ip, 4, ETHERTYPE_IP)); /* Time since that frame was seen */ ti = proto_tree_add_uint(duplicate_tree, @@ -897,30 +898,30 @@ dissect_atmarp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _ /* Extract the addresses. */ sha_offset = MIN_ATMARP_HEADER_SIZE; - sha_str = atmarpnum_to_str(tvb, sha_offset, ar_shtl); + sha_str = atmarpnum_to_str(pinfo->pool, tvb, sha_offset, ar_shtl); ssa_offset = sha_offset + ar_shl; if (ar_ssl != 0) { - ssa_str = atmarpsubaddr_to_str(tvb, ssa_offset, ar_sstl); + ssa_str = atmarpsubaddr_to_str(pinfo->pool, tvb, ssa_offset, ar_sstl); } else { ssa_str = NULL; } spa_offset = ssa_offset + ar_ssl; - spa_str = tvb_arpproaddr_to_str(tvb, spa_offset, ar_spln, ar_pro); + spa_str = tvb_arpproaddr_to_str(pinfo->pool, tvb, spa_offset, ar_spln, ar_pro); tha_offset = spa_offset + ar_spln; - tha_str = atmarpnum_to_str(tvb, tha_offset, ar_thtl); + tha_str = atmarpnum_to_str(pinfo->pool, tvb, tha_offset, ar_thtl); tsa_offset = tha_offset + ar_thl; if (ar_tsl != 0) { - tsa_str = atmarpsubaddr_to_str(tvb, tsa_offset, ar_tstl); + tsa_str = atmarpsubaddr_to_str(pinfo->pool, tvb, tsa_offset, ar_tstl); } else { tsa_str = NULL; } tpa_offset = tsa_offset + ar_tsl; - tpa_str = tvb_arpproaddr_to_str(tvb, tpa_offset, ar_tpln, ar_pro); + tpa_str = tvb_arpproaddr_to_str(pinfo->pool, tvb, tpa_offset, ar_tpln, ar_pro); switch (ar_op) { @@ -1278,8 +1279,8 @@ dissect_ax25arp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data /* Target Protocol Address */ tpa_offset = tha_offset + ar_hln; - spa_str = tvb_arpproaddr_to_str(tvb, spa_offset, ar_pln, ar_pro); - tpa_str = tvb_arpproaddr_to_str(tvb, tpa_offset, ar_pln, ar_pro); + spa_str = tvb_arpproaddr_to_str(pinfo->pool, tvb, spa_offset, ar_pln, ar_pro); + tpa_str = tvb_arpproaddr_to_str(pinfo->pool, tvb, tpa_offset, ar_pln, ar_pro); /* ARP requests/replies with the same sender and target protocol address are flagged as "gratuitous ARPs", i.e. ARPs sent out as, @@ -1306,22 +1307,22 @@ dissect_ax25arp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data else col_add_fstr(pinfo->cinfo, COL_INFO, "%s is at %s", spa_str, - tvb_arphrdaddr_to_str(tvb, sha_offset, ar_hln, ar_hrd)); + tvb_arphrdaddr_to_str(pinfo->pool, tvb, sha_offset, ar_hln, ar_hrd)); break; case ARPOP_RREQUEST: case ARPOP_IREQUEST: col_add_fstr(pinfo->cinfo, COL_INFO, "Who is %s? Tell %s", - tvb_arphrdaddr_to_str(tvb, tha_offset, ar_hln, ar_hrd), - tvb_arphrdaddr_to_str(tvb, sha_offset, ar_hln, ar_hrd)); + tvb_arphrdaddr_to_str(pinfo->pool, tvb, tha_offset, ar_hln, ar_hrd), + tvb_arphrdaddr_to_str(pinfo->pool, tvb, sha_offset, ar_hln, ar_hrd)); break; case ARPOP_RREPLY: col_add_fstr(pinfo->cinfo, COL_INFO, "%s is at %s", - tvb_arphrdaddr_to_str(tvb, tha_offset, ar_hln, ar_hrd), + tvb_arphrdaddr_to_str(pinfo->pool, tvb, tha_offset, ar_hln, ar_hrd), tpa_str); break; case ARPOP_IREPLY: col_add_fstr(pinfo->cinfo, COL_INFO, "%s is at %s", - tvb_arphrdaddr_to_str(tvb, sha_offset, ar_hln, ar_hrd), + tvb_arphrdaddr_to_str(pinfo->pool, tvb, sha_offset, ar_hln, ar_hrd), spa_str); break; default: @@ -1515,7 +1516,7 @@ dissect_arp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) multicast address nor an all-zero address and if sender IP address isn't all zeroes. */ ip = tvb_get_ipv4(tvb, spa_offset); - mac = (const guint8*)tvb_memdup(wmem_packet_scope(), tvb, sha_offset, 6); + mac = (const guint8*)tvb_memdup(pinfo->pool, tvb, sha_offset, 6); if ((mac[0] & 0x01) == 0 && memcmp(mac, mac_allzero, 6) != 0 && ip != 0) { if (global_arp_register_network_address_binding) @@ -1539,7 +1540,7 @@ dissect_arp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) ip = tvb_get_ipv4(tvb, tpa_offset); - mac = (const guint8*)tvb_memdup(wmem_packet_scope(), tvb, tha_offset, 6); + mac = (const guint8*)tvb_memdup(pinfo->pool, tvb, tha_offset, 6); if ((mac[0] & 0x01) == 0 && memcmp(mac, mac_allzero, 6) != 0 && ip != 0 && ar_op != ARPOP_REQUEST) { @@ -1582,42 +1583,42 @@ dissect_arp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) if (is_gratuitous) { if (is_announcement) { col_add_fstr(pinfo->cinfo, COL_INFO, "ARP Announcement for %s", - tvb_arpproaddr_to_str(tvb, tpa_offset, ar_pln, ar_pro)); + tvb_arpproaddr_to_str(pinfo->pool, tvb, tpa_offset, ar_pln, ar_pro)); } else { col_add_fstr(pinfo->cinfo, COL_INFO, "Gratuitous ARP for %s (Request)", - tvb_arpproaddr_to_str(tvb, tpa_offset, ar_pln, ar_pro)); + tvb_arpproaddr_to_str(pinfo->pool, tvb, tpa_offset, ar_pln, ar_pro)); } } else if (is_probe) { col_add_fstr(pinfo->cinfo, COL_INFO, "Who has %s? (ARP Probe)", - tvb_arpproaddr_to_str(tvb, tpa_offset, ar_pln, ar_pro)); + tvb_arpproaddr_to_str(pinfo->pool, tvb, tpa_offset, ar_pln, ar_pro)); } else { col_add_fstr(pinfo->cinfo, COL_INFO, "Who has %s? Tell %s", - tvb_arpproaddr_to_str(tvb, tpa_offset, ar_pln, ar_pro), - tvb_arpproaddr_to_str(tvb, spa_offset, ar_pln, ar_pro)); + tvb_arpproaddr_to_str(pinfo->pool, tvb, tpa_offset, ar_pln, ar_pro), + tvb_arpproaddr_to_str(pinfo->pool, tvb, spa_offset, ar_pln, ar_pro)); } break; case ARPOP_REPLY: if (is_gratuitous) col_add_fstr(pinfo->cinfo, COL_INFO, "Gratuitous ARP for %s (Reply)", - tvb_arpproaddr_to_str(tvb, spa_offset, ar_pln, ar_pro)); + tvb_arpproaddr_to_str(pinfo->pool, tvb, spa_offset, ar_pln, ar_pro)); else col_add_fstr(pinfo->cinfo, COL_INFO, "%s is at %s", - tvb_arpproaddr_to_str(tvb, spa_offset, ar_pln, ar_pro), - tvb_arphrdaddr_to_str(tvb, sha_offset, ar_hln, ar_hrd)); + tvb_arpproaddr_to_str(pinfo->pool, tvb, spa_offset, ar_pln, ar_pro), + tvb_arphrdaddr_to_str(pinfo->pool, tvb, sha_offset, ar_hln, ar_hrd)); break; case ARPOP_RREQUEST: case ARPOP_IREQUEST: case ARPOP_DRARPREQUEST: col_add_fstr(pinfo->cinfo, COL_INFO, "Who is %s? Tell %s", - tvb_arphrdaddr_to_str(tvb, tha_offset, ar_hln, ar_hrd), - tvb_arphrdaddr_to_str(tvb, sha_offset, ar_hln, ar_hrd)); + tvb_arphrdaddr_to_str(pinfo->pool, tvb, tha_offset, ar_hln, ar_hrd), + tvb_arphrdaddr_to_str(pinfo->pool, tvb, sha_offset, ar_hln, ar_hrd)); break; case ARPOP_RREPLY: case ARPOP_DRARPREPLY: col_add_fstr(pinfo->cinfo, COL_INFO, "%s is at %s", - tvb_arphrdaddr_to_str(tvb, tha_offset, ar_hln, ar_hrd), - tvb_arpproaddr_to_str(tvb, tpa_offset, ar_pln, ar_pro)); + tvb_arphrdaddr_to_str(pinfo->pool, tvb, tha_offset, ar_hln, ar_hrd), + tvb_arpproaddr_to_str(pinfo->pool, tvb, tpa_offset, ar_pln, ar_pro)); break; case ARPOP_DRARPERROR: @@ -1626,8 +1627,8 @@ dissect_arp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) case ARPOP_IREPLY: col_add_fstr(pinfo->cinfo, COL_INFO, "%s is at %s", - tvb_arphrdaddr_to_str(tvb, sha_offset, ar_hln, ar_hrd), - tvb_arpproaddr_to_str(tvb, spa_offset, ar_pln, ar_pro)); + tvb_arphrdaddr_to_str(pinfo->pool, tvb, sha_offset, ar_hln, ar_hrd), + tvb_arpproaddr_to_str(pinfo->pool, tvb, spa_offset, ar_pln, ar_pro)); break; case ATMARPOP_NAK: @@ -1636,80 +1637,80 @@ dissect_arp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) case ARPOP_MARS_REQUEST: col_add_fstr(pinfo->cinfo, COL_INFO, "MARS request from %s at %s", - tvb_arphrdaddr_to_str(tvb, sha_offset, ar_hln, ar_hrd), - tvb_arpproaddr_to_str(tvb, spa_offset, ar_pln, ar_pro)); + tvb_arphrdaddr_to_str(pinfo->pool, tvb, sha_offset, ar_hln, ar_hrd), + tvb_arpproaddr_to_str(pinfo->pool, tvb, spa_offset, ar_pln, ar_pro)); break; case ARPOP_MARS_MULTI: col_add_fstr(pinfo->cinfo, COL_INFO, "MARS MULTI request from %s at %s", - tvb_arphrdaddr_to_str(tvb, sha_offset, ar_hln, ar_hrd), - tvb_arpproaddr_to_str(tvb, spa_offset, ar_pln, ar_pro)); + tvb_arphrdaddr_to_str(pinfo->pool, tvb, sha_offset, ar_hln, ar_hrd), + tvb_arpproaddr_to_str(pinfo->pool, tvb, spa_offset, ar_pln, ar_pro)); break; case ARPOP_MARS_MSERV: col_add_fstr(pinfo->cinfo, COL_INFO, "MARS MSERV request from %s at %s", - tvb_arphrdaddr_to_str(tvb, sha_offset, ar_hln, ar_hrd), - tvb_arpproaddr_to_str(tvb, spa_offset, ar_pln, ar_pro)); + tvb_arphrdaddr_to_str(pinfo->pool, tvb, sha_offset, ar_hln, ar_hrd), + tvb_arpproaddr_to_str(pinfo->pool, tvb, spa_offset, ar_pln, ar_pro)); break; case ARPOP_MARS_JOIN: col_add_fstr(pinfo->cinfo, COL_INFO, "MARS JOIN request from %s at %s", - tvb_arphrdaddr_to_str(tvb, sha_offset, ar_hln, ar_hrd), - tvb_arpproaddr_to_str(tvb, spa_offset, ar_pln, ar_pro)); + tvb_arphrdaddr_to_str(pinfo->pool, tvb, sha_offset, ar_hln, ar_hrd), + tvb_arpproaddr_to_str(pinfo->pool, tvb, spa_offset, ar_pln, ar_pro)); break; case ARPOP_MARS_LEAVE: col_add_fstr(pinfo->cinfo, COL_INFO, "MARS LEAVE from %s at %s", - tvb_arphrdaddr_to_str(tvb, sha_offset, ar_hln, ar_hrd), - tvb_arpproaddr_to_str(tvb, spa_offset, ar_pln, ar_pro)); + tvb_arphrdaddr_to_str(pinfo->pool, tvb, sha_offset, ar_hln, ar_hrd), + tvb_arpproaddr_to_str(pinfo->pool, tvb, spa_offset, ar_pln, ar_pro)); break; case ARPOP_MARS_NAK: col_add_fstr(pinfo->cinfo, COL_INFO, "MARS NAK from %s at %s", - tvb_arphrdaddr_to_str(tvb, sha_offset, ar_hln, ar_hrd), - tvb_arpproaddr_to_str(tvb, spa_offset, ar_pln, ar_pro)); + tvb_arphrdaddr_to_str(pinfo->pool, tvb, sha_offset, ar_hln, ar_hrd), + tvb_arpproaddr_to_str(pinfo->pool, tvb, spa_offset, ar_pln, ar_pro)); break; case ARPOP_MARS_UNSERV: col_add_fstr(pinfo->cinfo, COL_INFO, "MARS UNSERV request from %s at %s", - tvb_arphrdaddr_to_str(tvb, sha_offset, ar_hln, ar_hrd), - tvb_arpproaddr_to_str(tvb, spa_offset, ar_pln, ar_pro)); + tvb_arphrdaddr_to_str(pinfo->pool, tvb, sha_offset, ar_hln, ar_hrd), + tvb_arpproaddr_to_str(pinfo->pool, tvb, spa_offset, ar_pln, ar_pro)); break; case ARPOP_MARS_SJOIN: col_add_fstr(pinfo->cinfo, COL_INFO, "MARS SJOIN request from %s at %s", - tvb_arphrdaddr_to_str(tvb, sha_offset, ar_hln, ar_hrd), - tvb_arpproaddr_to_str(tvb, spa_offset, ar_pln, ar_pro)); + tvb_arphrdaddr_to_str(pinfo->pool, tvb, sha_offset, ar_hln, ar_hrd), + tvb_arpproaddr_to_str(pinfo->pool, tvb, spa_offset, ar_pln, ar_pro)); break; case ARPOP_MARS_SLEAVE: col_add_fstr(pinfo->cinfo, COL_INFO, "MARS SLEAVE from %s at %s", - tvb_arphrdaddr_to_str(tvb, sha_offset, ar_hln, ar_hrd), - tvb_arpproaddr_to_str(tvb, spa_offset, ar_pln, ar_pro)); + tvb_arphrdaddr_to_str(pinfo->pool, tvb, sha_offset, ar_hln, ar_hrd), + tvb_arpproaddr_to_str(pinfo->pool, tvb, spa_offset, ar_pln, ar_pro)); break; case ARPOP_MARS_GROUPLIST_REQUEST: col_add_fstr(pinfo->cinfo, COL_INFO, "MARS grouplist request from %s at %s", - tvb_arphrdaddr_to_str(tvb, sha_offset, ar_hln, ar_hrd), - tvb_arpproaddr_to_str(tvb, spa_offset, ar_pln, ar_pro)); + tvb_arphrdaddr_to_str(pinfo->pool, tvb, sha_offset, ar_hln, ar_hrd), + tvb_arpproaddr_to_str(pinfo->pool, tvb, spa_offset, ar_pln, ar_pro)); break; case ARPOP_MARS_GROUPLIST_REPLY: col_add_fstr(pinfo->cinfo, COL_INFO, "MARS grouplist reply from %s at %s", - tvb_arphrdaddr_to_str(tvb, sha_offset, ar_hln, ar_hrd), - tvb_arpproaddr_to_str(tvb, spa_offset, ar_pln, ar_pro)); + tvb_arphrdaddr_to_str(pinfo->pool, tvb, sha_offset, ar_hln, ar_hrd), + tvb_arpproaddr_to_str(pinfo->pool, tvb, spa_offset, ar_pln, ar_pro)); break; case ARPOP_MARS_REDIRECT_MAP: col_add_fstr(pinfo->cinfo, COL_INFO, "MARS redirect map from %s at %s", - tvb_arphrdaddr_to_str(tvb, sha_offset, ar_hln, ar_hrd), - tvb_arpproaddr_to_str(tvb, spa_offset, ar_pln, ar_pro)); + tvb_arphrdaddr_to_str(pinfo->pool, tvb, sha_offset, ar_hln, ar_hrd), + tvb_arpproaddr_to_str(pinfo->pool, tvb, spa_offset, ar_pln, ar_pro)); break; case ARPOP_MAPOS_UNARP: col_add_fstr(pinfo->cinfo, COL_INFO, "MAPOS UNARP request from %s at %s", - tvb_arphrdaddr_to_str(tvb, sha_offset, ar_hln, ar_hrd), - tvb_arpproaddr_to_str(tvb, spa_offset, ar_pln, ar_pro)); + tvb_arphrdaddr_to_str(pinfo->pool, tvb, sha_offset, ar_hln, ar_hrd), + tvb_arpproaddr_to_str(pinfo->pool, tvb, spa_offset, ar_pln, ar_pro)); break; case ARPOP_EXP1: @@ -1800,7 +1801,7 @@ dissect_arp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { /* Also indicate in info column */ col_append_fstr(pinfo->cinfo, COL_INFO, " (duplicate use of %s detected!)", - arpproaddr_to_str((guint8*)&duplicate_ip, 4, ETHERTYPE_IP)); + arpproaddr_to_str(pinfo->pool, (guint8*)&duplicate_ip, 4, ETHERTYPE_IP)); } return tvb_captured_length(tvb); } diff --git a/epan/dissectors/packet-arp.h b/epan/dissectors/packet-arp.h index 01e83b2d61..e64421123e 100644 --- a/epan/dissectors/packet-arp.h +++ b/epan/dissectors/packet-arp.h @@ -12,7 +12,7 @@ #ifndef __PACKET_ARP_H__ #define __PACKET_ARP_H__ -const gchar *tvb_arphrdaddr_to_str(tvbuff_t *tvb, gint offset, int ad_len, guint16 type); +const gchar *tvb_arphrdaddr_to_str(wmem_allocator_t *scope, tvbuff_t *tvb, gint offset, int ad_len, guint16 type); void dissect_atm_nsap(tvbuff_t *tvb, packet_info* pinfo, int offset, int len, proto_tree *tree); diff --git a/epan/dissectors/packet-awdl.c b/epan/dissectors/packet-awdl.c index e296ff6017..892dd0eead 100644 --- a/epan/dissectors/packet-awdl.c +++ b/epan/dissectors/packet-awdl.c @@ -700,7 +700,7 @@ awdl_tag_service_params(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, } static int -awdl_tag_channel_sequence(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) { +awdl_tag_channel_sequence(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *chanlist_item, *channel_item; proto_tree *chanlist_tree, *channel_tree; guint channels, chan_number; @@ -730,7 +730,7 @@ awdl_tag_channel_sequence(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tre offset += 2; /* make sufficient space for channel decodings: 5 chars/channel (3-digit number + ', ') */ - strbuf = wmem_strbuf_new_sized(wmem_packet_scope(), 5 * channels); + strbuf = wmem_strbuf_new_sized(pinfo->pool, 5 * channels); switch (seq_enc) { case AWDL_CHANSEQ_ENC_CHANNELNUMBER: @@ -1133,13 +1133,13 @@ awdl_tag_ht_capabilities(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree */ static int add_awdl_dns_name(proto_tree *tree, int hfindex_regular, int hfindex_compressed, - tvbuff_t *tvb, int offset, int len, const gchar **name) { + tvbuff_t *tvb, int offset, int len, wmem_allocator_t *scope, const gchar **name) { int start_offset = offset; guint8 component_len; const guchar *component; wmem_strbuf_t *strbuf; - strbuf = wmem_strbuf_new_sized(wmem_packet_scope(), MAX_DNAME_LEN); + strbuf = wmem_strbuf_new_sized(scope, MAX_DNAME_LEN); while (offset < (len + start_offset)) { component_len = tvb_get_guint8(tvb, offset); @@ -1157,7 +1157,7 @@ add_awdl_dns_name(proto_tree *tree, int hfindex_regular, int hfindex_compressed, } else { /* regular label */ guint label_len; - proto_tree_add_item_ret_string_and_length(tree, hfindex_regular, tvb, offset, 1, ENC_ASCII, wmem_packet_scope(), &component, &label_len); + proto_tree_add_item_ret_string_and_length(tree, hfindex_regular, tvb, offset, 1, ENC_ASCII, scope, &component, &label_len); offset += label_len; } if (component) { @@ -1174,7 +1174,7 @@ add_awdl_dns_name(proto_tree *tree, int hfindex_regular, int hfindex_compressed, } static int -add_awdl_dns_entry(proto_tree *tree, gint ett, +add_awdl_dns_entry(packet_info *pinfo, proto_tree *tree, gint ett, int hfindex_entry, int hfindex_regular, int hfindex_compressed, tvbuff_t *tvb, int offset, int len, const gchar **name) { int start_offset = offset; @@ -1184,7 +1184,7 @@ add_awdl_dns_entry(proto_tree *tree, gint ett, entry_item = proto_tree_add_item(tree, hfindex_entry, tvb, offset, 0, ENC_NA); entry_tree = proto_item_add_subtree(entry_item, ett); - offset += add_awdl_dns_name(entry_tree, hfindex_regular, hfindex_compressed, tvb, offset, len, &n); + offset += add_awdl_dns_name(entry_tree, hfindex_regular, hfindex_compressed, tvb, offset, len, pinfo->pool, &n); proto_item_set_end(entry_item, tvb, offset); proto_item_append_text(entry_item, ": %s", n); @@ -1195,20 +1195,20 @@ add_awdl_dns_entry(proto_tree *tree, gint ett, } static int -awdl_tag_arpa(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) { +awdl_tag_arpa(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { int offset = 0; int tag_len = tvb_reported_length(tvb); proto_tree_add_item(tree, hf_awdl_arpa_flags, tvb, offset, 1, ENC_NA); offset += 1; - offset += add_awdl_dns_entry(tree, ett_awdl_dns_name, hf_awdl_arpa, hf_awdl_arpa_name, + offset += add_awdl_dns_entry(pinfo, tree, ett_awdl_dns_name, hf_awdl_arpa, hf_awdl_arpa_name, hf_awdl_arpa_short, tvb, offset, tag_len - offset, NULL); return offset; } static int -awdl_tag_service_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) { +awdl_tag_service_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *rr_item; proto_tree *rr_tree, *data_len; const gchar *name; @@ -1223,7 +1223,7 @@ awdl_tag_service_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tre // len field includes the following type value len -= 1; - offset += add_awdl_dns_entry(rr_tree, ett_awdl_dns_name, hf_awdl_dns_name, hf_awdl_dns_name_label, + offset += add_awdl_dns_entry(pinfo, rr_tree, ett_awdl_dns_name, hf_awdl_dns_name, hf_awdl_dns_name_label, hf_awdl_dns_name_short, tvb, offset, len, &name); proto_tree_add_item_ret_uint(rr_tree, hf_awdl_dns_type, tvb, offset, 1, ENC_LITTLE_ENDIAN, &type); @@ -1243,7 +1243,7 @@ awdl_tag_service_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tre const guchar *txt; gint label_len; proto_tree_add_item_ret_string_and_length(rr_tree, hf_awdl_dns_txt, tvb, offset, 1, ENC_ASCII, - wmem_packet_scope(), &txt, &label_len); + pinfo->pool, &txt, &label_len); offset += label_len; proto_item_append_text(rr_item, ", %s", txt); if (label_len > (gint) len) { @@ -1263,12 +1263,12 @@ awdl_tag_service_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tre offset += 2; // length field includes above fields len -= 6; - offset += add_awdl_dns_entry(rr_tree, ett_awdl_dns_name, hf_awdl_dns_target, hf_awdl_dns_target_label, + offset += add_awdl_dns_entry(pinfo, rr_tree, ett_awdl_dns_name, hf_awdl_dns_target, hf_awdl_dns_target_label, hf_awdl_dns_target_short, tvb, offset, len, &name); proto_item_append_text(rr_item, ", priority %u, weight %u, port %u, target %s", prio, weight, port, name); break; case T_PTR: - offset += add_awdl_dns_entry(rr_tree, ett_awdl_dns_name, hf_awdl_dns_ptr, hf_awdl_dns_ptr_label, + offset += add_awdl_dns_entry(pinfo, rr_tree, ett_awdl_dns_name, hf_awdl_dns_ptr, hf_awdl_dns_ptr_label, hf_awdl_dns_ptr_short, tvb, offset, len, &name); proto_item_append_text(rr_item, ", %s", name); break; diff --git a/epan/dissectors/packet-batadv.c b/epan/dissectors/packet-batadv.c index 1a88d70389..54ff6fe6cd 100644 --- a/epan/dissectors/packet-batadv.c +++ b/epan/dissectors/packet-batadv.c @@ -2132,7 +2132,7 @@ static void dissect_batadv_icmp_v6(tvbuff_t *tvb, packet_info *pinfo, proto_tree } static void -dissect_batadv_icmp_rr(proto_tree *batadv_icmp_tree, tvbuff_t *tvb, int offset) +dissect_batadv_icmp_rr(packet_info *pinfo, proto_tree *batadv_icmp_tree, tvbuff_t *tvb, int offset) { proto_tree *field_tree; int ptr, i; @@ -2149,7 +2149,7 @@ dissect_batadv_icmp_rr(proto_tree *batadv_icmp_tree, tvbuff_t *tvb, int offset) offset++; for (i = 0; i < BAT_RR_LEN; i++) { proto_tree_add_ether_format(field_tree, hf_batadv_icmp_rr_ether, tvb, offset, 6, tvb_get_ptr(tvb, offset, 6), - "%s%s", (i > ptr) ? "-" : tvb_ether_to_str(wmem_packet_scope(), tvb, offset), + "%s%s", (i > ptr) ? "-" : tvb_ether_to_str(pinfo->pool, tvb, offset), (i == ptr) ? " <- (current)" : ""); offset += 6; @@ -2157,7 +2157,7 @@ dissect_batadv_icmp_rr(proto_tree *batadv_icmp_tree, tvbuff_t *tvb, int offset) } static void -dissect_batadv_icmp_rr_v15(proto_tree *batadv_icmp_tree, tvbuff_t *tvb, +dissect_batadv_icmp_rr_v15(packet_info *pinfo, proto_tree *batadv_icmp_tree, tvbuff_t *tvb, int offset, int ptr) { proto_tree *field_tree; @@ -2174,7 +2174,7 @@ dissect_batadv_icmp_rr_v15(proto_tree *batadv_icmp_tree, tvbuff_t *tvb, tvb, offset, 6, tvb_get_ptr(tvb, offset, 6), "%s%s", - (i > ptr) ? "-" : tvb_ether_to_str(wmem_packet_scope(), tvb, offset), + (i > ptr) ? "-" : tvb_ether_to_str(pinfo->pool, tvb, offset), (i == ptr) ? " <- (current)" : ""); offset += 6; @@ -2248,7 +2248,7 @@ static void dissect_batadv_icmp_v7(tvbuff_t *tvb, packet_info *pinfo, proto_tree /* rr data available? */ length_remaining = tvb_reported_length_remaining(tvb, offset); if (length_remaining >= 1 + BAT_RR_LEN * 6) { - dissect_batadv_icmp_rr(batadv_icmp_tree, tvb, offset); + dissect_batadv_icmp_rr(pinfo, batadv_icmp_tree, tvb, offset); offset += 1 + BAT_RR_LEN * 6; } @@ -2332,7 +2332,7 @@ static void dissect_batadv_icmp_v14(tvbuff_t *tvb, packet_info *pinfo, proto_tre /* rr data available? */ length_remaining = tvb_reported_length_remaining(tvb, offset); if (length_remaining >= 1 + BAT_RR_LEN * 6) { - dissect_batadv_icmp_rr(batadv_icmp_tree, tvb, offset); + dissect_batadv_icmp_rr(pinfo, batadv_icmp_tree, tvb, offset); offset += 1 + BAT_RR_LEN * 6; } @@ -2534,7 +2534,7 @@ static void dissect_batadv_icmp_simple_v15(tvbuff_t *tvb, packet_info *pinfo, /* rr data available? */ length_remaining = tvb_reported_length_remaining(tvb, offset); if (length_remaining >= BAT_RR_LEN * 6) { - dissect_batadv_icmp_rr_v15(batadv_icmp_tree, tvb, offset, + dissect_batadv_icmp_rr_v15(pinfo, batadv_icmp_tree, tvb, offset, icmp_packeth->rr_ptr); offset += BAT_RR_LEN * 6; } diff --git a/epan/dissectors/packet-bluecom.c b/epan/dissectors/packet-bluecom.c index a723a4064e..6033c84396 100644 --- a/epan/dissectors/packet-bluecom.c +++ b/epan/dissectors/packet-bluecom.c @@ -159,7 +159,7 @@ static const value_string bcp_cmds[] = { * return: nothing */ static void -dissect_bcp_connect_data(proto_tree *bcp_tree, tvbuff_t *tvb, gint flags) +dissect_bcp_connect_data(packet_info *pinfo, proto_tree *bcp_tree, tvbuff_t *tvb, gint flags) { proto_tree *bcp_subtree = NULL; guint offset = 0; @@ -170,8 +170,8 @@ dissect_bcp_connect_data(proto_tree *bcp_tree, tvbuff_t *tvb, gint flags) { bcp_subtree = proto_tree_add_subtree_format(bcp_tree, tvb, offset, len, ett_bcp_data, NULL, "BCP Connect Request: Name=%s IpAddr=%s", - tvb_get_string_enc(wmem_packet_scope(), tvb, offset + 16, BCP_NAME_LEN, ENC_ASCII), - tvb_ip_to_str(wmem_packet_scope(), tvb, offset + 12)); + tvb_get_string_enc(pinfo->pool, tvb, offset + 16, BCP_NAME_LEN, ENC_ASCII), + tvb_ip_to_str(pinfo->pool, tvb, offset + 12)); proto_tree_add_item(bcp_subtree, hf_bcp_connectreq_lenin, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; @@ -215,7 +215,7 @@ dissect_bcp_connect_data(proto_tree *bcp_tree, tvbuff_t *tvb, gint flags) * return: nothing */ static void -dissect_bcp_search_data(proto_tree *bcp_tree, tvbuff_t *tvb, gint flags) +dissect_bcp_search_data(packet_info *pinfo, proto_tree *bcp_tree, tvbuff_t *tvb, gint flags) { proto_tree *bcp_subtree = NULL; guint type = 0; @@ -231,15 +231,15 @@ dissect_bcp_search_data(proto_tree *bcp_tree, tvbuff_t *tvb, gint flags) case BCP_SEARCH_IPADDR: bcp_subtree = proto_tree_add_subtree_format(bcp_tree, tvb, offset, len, ett_bcp_data, NULL, "BCP Search Request: IpAddrFirst=%s, IpAddrLast=%s", - tvb_ip_to_str(wmem_packet_scope(), tvb, offset + 8), - tvb_ip_to_str(wmem_packet_scope(), tvb, offset + 12) + tvb_ip_to_str(pinfo->pool, tvb, offset + 8), + tvb_ip_to_str(pinfo->pool, tvb, offset + 12) ); break; case BCP_SEARCH_NAME: bcp_subtree = proto_tree_add_subtree_format(bcp_tree, tvb, offset, len, ett_bcp_data, NULL, "BCP Search Request: Name=%s", - tvb_get_string_enc(wmem_packet_scope(), tvb, offset + 8, BCP_NAME_LEN, ENC_ASCII) + tvb_get_string_enc(pinfo->pool, tvb, offset + 8, BCP_NAME_LEN, ENC_ASCII) ); break; @@ -277,8 +277,8 @@ dissect_bcp_search_data(proto_tree *bcp_tree, tvbuff_t *tvb, gint flags) { bcp_subtree = proto_tree_add_subtree_format(bcp_tree, tvb, offset, len, ett_bcp_data, NULL, "BCP Search Response: Name=%s, IpAddr=%s Error=%d", - tvb_get_string_enc(wmem_packet_scope(), tvb, offset + 16, BCP_NAME_LEN, ENC_ASCII), - tvb_ip_to_str(wmem_packet_scope(), tvb, offset + 12), + tvb_get_string_enc(pinfo->pool, tvb, offset + 16, BCP_NAME_LEN, ENC_ASCII), + tvb_ip_to_str(pinfo->pool, tvb, offset + 12), tvb_get_letohl(tvb, offset) ); @@ -310,7 +310,7 @@ dissect_bcp_search_data(proto_tree *bcp_tree, tvbuff_t *tvb, gint flags) * return: nothing */ static void -dissect_bcp_identify_data(proto_tree *bcp_tree, tvbuff_t *tvb) +dissect_bcp_identify_data(packet_info *pinfo, proto_tree *bcp_tree, tvbuff_t *tvb) { proto_tree *bcp_subtree = NULL; guint offset = 0; @@ -319,8 +319,8 @@ dissect_bcp_identify_data(proto_tree *bcp_tree, tvbuff_t *tvb) bcp_subtree = proto_tree_add_subtree_format(bcp_tree, tvb, offset, len, ett_bcp_data, NULL, "BCP Identify Request: Name=%s, IpAddr=%s", - tvb_get_string_enc(wmem_packet_scope(), tvb, offset + 12, BCP_NAME_LEN, ENC_ASCII), - tvb_ip_to_str(wmem_packet_scope(), tvb, offset + 8) + tvb_get_string_enc(pinfo->pool, tvb, offset + 12, BCP_NAME_LEN, ENC_ASCII), + tvb_ip_to_str(pinfo->pool, tvb, offset + 8) ); proto_tree_add_item(bcp_subtree, hf_bcp_identify_error, tvb, offset, 4, ENC_BIG_ENDIAN); @@ -536,17 +536,17 @@ static int dissect_bluecom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, break; case BCP_BLK_CMD_IDENTIFY: - dissect_bcp_identify_data(bcp_tree, block_tvb); + dissect_bcp_identify_data(pinfo, bcp_tree, block_tvb); break; case BCP_BLK_CMD_SEARCH: col_append_str(pinfo->cinfo, COL_INFO, REQRSP(flags)); - dissect_bcp_search_data(bcp_tree, block_tvb, flags); + dissect_bcp_search_data(pinfo, bcp_tree, block_tvb, flags); break; case BCP_BLK_CMD_CONNECT: col_append_str(pinfo->cinfo, COL_INFO, REQRSP(flags)); - dissect_bcp_connect_data(bcp_tree, block_tvb, flags); + dissect_bcp_connect_data(pinfo, bcp_tree, block_tvb, flags); break; case BCP_BLK_CMD_DATA: diff --git a/epan/dissectors/packet-bpv6.c b/epan/dissectors/packet-bpv6.c index 4a66ff9683..ed53a6774d 100644 --- a/epan/dissectors/packet-bpv6.c +++ b/epan/dissectors/packet-bpv6.c @@ -1970,11 +1970,11 @@ dissect_bundle(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ } } - wscbor_chunk_t *frame = wscbor_chunk_read(wmem_packet_scope(), tvb, &offset); + wscbor_chunk_t *frame = wscbor_chunk_read(pinfo->pool, tvb, &offset); if (frame->type_major == CBOR_TYPE_ARRAY) { - wscbor_chunk_t *primary = wscbor_chunk_read(wmem_packet_scope(), tvb, &offset); + wscbor_chunk_t *primary = wscbor_chunk_read(pinfo->pool, tvb, &offset); if (primary->type_major == CBOR_TYPE_ARRAY) { - wscbor_chunk_t *version = wscbor_chunk_read(wmem_packet_scope(), tvb, &offset); + wscbor_chunk_t *version = wscbor_chunk_read(pinfo->pool, tvb, &offset); if (version->type_major == CBOR_TYPE_UINT) { guint64 vers_val = version->head_value; if (vers_val == 7) { diff --git a/epan/dissectors/packet-cdp.c b/epan/dissectors/packet-cdp.c index ce7a61e7a7..8939357af7 100644 --- a/epan/dissectors/packet-cdp.c +++ b/epan/dissectors/packet-cdp.c @@ -156,7 +156,7 @@ dissect_nrgyz_tlv(tvbuff_t *tvb, packet_info* pinfo, int offset, guint16 length, static void dissect_spare_poe_tlv(tvbuff_t *tvb, int offset, int length, proto_tree *tree); static void -add_multi_line_string_to_tree(proto_tree *tree, tvbuff_t *tvb, gint start, +add_multi_line_string_to_tree(wmem_allocator_t *scope, proto_tree *tree, tvbuff_t *tvb, gint start, gint len, int hf); #define TYPE_DEVICE_ID 0x0001 @@ -452,7 +452,7 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) length, ett_cdp_tlv, NULL, "Software Version"); proto_tree_add_item(tlv_tree, hf_cdp_tlvtype, tvb, offset + TLV_TYPE, 2, ENC_BIG_ENDIAN); proto_tree_add_item(tlv_tree, hf_cdp_tlvlength, tvb, offset + TLV_LENGTH, 2, ENC_BIG_ENDIAN); - add_multi_line_string_to_tree(tlv_tree, tvb, offset + 4, + add_multi_line_string_to_tree(pinfo->pool, tlv_tree, tvb, offset + 4, length - 4, hf_cdp_software_version); } offset += length; @@ -1279,7 +1279,7 @@ dissect_spare_poe_tlv(tvbuff_t *tvb, int offset, int length, } static void -add_multi_line_string_to_tree(proto_tree *tree, tvbuff_t *tvb, gint start, +add_multi_line_string_to_tree(wmem_allocator_t *scope, proto_tree *tree, tvbuff_t *tvb, gint start, gint len, int hf) { gint next; @@ -1289,7 +1289,7 @@ add_multi_line_string_to_tree(proto_tree *tree, tvbuff_t *tvb, gint start, while (len > 0) { line_len = tvb_find_line_end(tvb, start, len, &next, FALSE); data_len = next - start; - proto_tree_add_string(tree, hf, tvb, start, data_len, tvb_format_stringzpad(wmem_packet_scope(), tvb, start, line_len)); + proto_tree_add_string(tree, hf, tvb, start, data_len, tvb_format_stringzpad(scope, tvb, start, line_len)); start += data_len; len -= data_len; } diff --git a/epan/dissectors/packet-dhcp-failover.c b/epan/dissectors/packet-dhcp-failover.c index dbd4fb0930..b19317ba5b 100644 --- a/epan/dissectors/packet-dhcp-failover.c +++ b/epan/dissectors/packet-dhcp-failover.c @@ -512,7 +512,7 @@ dissect_dhcpfo_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da break; } htype = tvb_get_guint8(tvb, offset); - htype_str = tvb_arphrdaddr_to_str(tvb, offset+1, option_length-1, + htype_str = tvb_arphrdaddr_to_str(pinfo->pool, tvb, offset+1, option_length-1, htype); proto_item_append_text(oi, ", %s, %s", htype_str, diff --git a/epan/dissectors/packet-dhcp.c b/epan/dissectors/packet-dhcp.c index 05d394979b..db9f0bb032 100644 --- a/epan/dissectors/packet-dhcp.c +++ b/epan/dissectors/packet-dhcp.c @@ -1133,7 +1133,7 @@ static const enum_val_t pkt_ccc_protocol_versions[] = { static gint pkt_ccc_protocol_version = PACKETCABLE_CCC_RFC_3495; static guint pkt_ccc_option = 122; -static void dissect_docsis_cm_cap(proto_tree *v_tree, tvbuff_t *tvb, +static void dissect_docsis_cm_cap(packet_info *pinfo, proto_tree *v_tree, tvbuff_t *tvb, int voff, int len, gboolean opt125); #define ARUBA_INSTANT_AP "ArubaInstantAP" @@ -2051,7 +2051,7 @@ dhcp_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree, int voff, case 60: *vendor_class_id_p = - tvb_get_string_enc(wmem_packet_scope(), + tvb_get_string_enc(pinfo->pool, tvb, voff+2, consumed-2, ENC_ASCII); break; case 119: @@ -2295,7 +2295,7 @@ dissect_dhcpopt_client_identifier(tvbuff_t *tvb, packet_info *pinfo, proto_tree proto_tree_add_item(tree, hf_dhcp_hw_ether_addr, tvb, offset+1, 6, ENC_NA); else proto_tree_add_string(tree, hf_dhcp_client_hardware_address, tvb, offset+1, 6, - tvb_arphrdaddr_to_str(tvb, offset+1, 6, byte)); + tvb_arphrdaddr_to_str(pinfo->pool, tvb, offset+1, 6, byte)); } else if (length == 17 && byte == 0) { /* Identifier is a UUID */ proto_tree_add_item(tree, hf_dhcp_client_identifier_uuid, tvb, offset + 1, 16, dhcp_uuid_endian); @@ -2311,7 +2311,7 @@ dissect_dhcpopt_client_identifier(tvbuff_t *tvb, packet_info *pinfo, proto_tree /* The type field is immediately followed by the IAID, which is an opaque 32-bit quantity */ proto_tree_add_string(tree, hf_dhcp_client_id_iaid, tvb, offset+1, 4, - tvb_arphrdaddr_to_str(tvb, offset+1, 4, byte)); + tvb_arphrdaddr_to_str(pinfo->pool, tvb, offset+1, 4, byte)); offset += 5; duidtype = tvb_get_ntohs(tvb, offset); proto_tree_add_item(tree, hf_dhcp_client_id_duid_type, tvb, offset, 2, ENC_BIG_ENDIAN); @@ -2329,7 +2329,7 @@ dissect_dhcpopt_client_identifier(tvbuff_t *tvb, packet_info *pinfo, proto_tree proto_tree_add_item(tree, hf_dhcp_client_identifier_time, tvb, offset + 4, 4, ENC_BIG_ENDIAN); if (length > 8) { proto_tree_add_string(tree, hf_dhcp_client_identifier_link_layer_address, tvb, offset + 8, - length - 13, tvb_arphrdaddr_to_str(tvb, offset+8, length-13, hwtype)); + length - 13, tvb_arphrdaddr_to_str(pinfo->pool, tvb, offset+8, length-13, hwtype)); } break; case DUID_EN: @@ -2353,7 +2353,7 @@ dissect_dhcpopt_client_identifier(tvbuff_t *tvb, packet_info *pinfo, proto_tree if (length > 4) { proto_tree_add_string(tree, hf_dhcp_client_identifier_link_layer_address, tvb, offset + 4, - length - 9, tvb_arphrdaddr_to_str(tvb, offset+4, length-9, hwtype)); + length - 9, tvb_arphrdaddr_to_str(pinfo->pool, tvb, offset+4, length-9, hwtype)); } break; } @@ -2504,7 +2504,7 @@ dissect_dhcpopt_client_full_domain_name(tvbuff_t *tvb, packet_info *pinfo, proto if (fqdn_flags & F_FQDN_E) { get_dns_name(tvb, offset+3, length-3, offset+3, (const char **)&dns_name, &dns_name_len); proto_tree_add_string(tree, hf_dhcp_fqdn_name, - tvb, offset+3, length-3, format_text(wmem_packet_scope(), dns_name, dns_name_len)); + tvb, offset+3, length-3, format_text(pinfo->pool, dns_name, dns_name_len)); } else { proto_tree_add_item(tree, hf_dhcp_fqdn_asciiname, tvb, offset+3, length-3, ENC_ASCII); } @@ -2685,7 +2685,7 @@ dissect_dhcpopt_client_network_interface_id(tvbuff_t *tvb, packet_info *pinfo _U } static int -dissect_dhcpopt_client_identifier_uuid(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) +dissect_dhcpopt_client_identifier_uuid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { int offset = 0, length = tvb_reported_length(tvb); guint8 byte; @@ -2710,7 +2710,7 @@ dissect_dhcpopt_client_identifier_uuid(tvbuff_t *tvb, packet_info *pinfo _U_, pr proto_tree_add_item(tree, hf_dhcp_hw_ether_addr, tvb, offset+1, 6, ENC_NA); else proto_tree_add_string(tree, hf_dhcp_client_hardware_address, tvb, offset+1, 6, - tvb_arphrdaddr_to_str(tvb, offset+1, 6, byte)); + tvb_arphrdaddr_to_str(pinfo->pool, tvb, offset+1, 6, byte)); } else if (length == 17 && byte == 0) { /* Identifier is a UUID */ proto_tree_add_item(tree, hf_dhcp_client_identifier_uuid, tvb, offset + 1, 16, dhcp_uuid_endian); @@ -2805,7 +2805,7 @@ dissect_dhcpopt_name_server_search(tvbuff_t *tvb, packet_info *pinfo, proto_tree } static int -dissect_dhcpopt_dhcp_domain_search(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) +dissect_dhcpopt_dhcp_domain_search(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { int length = tvb_reported_length(tvb); gchar *name_out; @@ -2817,10 +2817,10 @@ dissect_dhcpopt_dhcp_domain_search(tvbuff_t *tvb, packet_info *pinfo _U_, proto_ rfc3396_dns_domain_search_list.index_current_block++; if (rfc3396_dns_domain_search_list.total_number_of_block > 1) { proto_tree_add_string(tree, hf_dhcp_option_dhcp_dns_domain_search_list_rfc_3396_detected, tvb, 0, length, - wmem_strdup_printf(wmem_packet_scope(), "%u/%u", rfc3396_dns_domain_search_list.index_current_block, rfc3396_dns_domain_search_list.total_number_of_block)); + wmem_strdup_printf(pinfo->pool, "%u/%u", rfc3396_dns_domain_search_list.index_current_block, rfc3396_dns_domain_search_list.total_number_of_block)); if (rfc3396_dns_domain_search_list.index_current_block != rfc3396_dns_domain_search_list.total_number_of_block) { proto_tree_add_string(tree, hf_dhcp_option_dhcp_dns_domain_search_list_refer_last_option, tvb, 0, length, - wmem_strdup_printf(wmem_packet_scope(), "%u/%u", rfc3396_dns_domain_search_list.total_number_of_block, rfc3396_dns_domain_search_list.total_number_of_block)); + wmem_strdup_printf(pinfo->pool, "%u/%u", rfc3396_dns_domain_search_list.total_number_of_block, rfc3396_dns_domain_search_list.total_number_of_block)); } } @@ -2845,7 +2845,7 @@ dissect_dhcpopt_dhcp_domain_search(tvbuff_t *tvb, packet_info *pinfo _U_, proto_ /* use the get_dns_name method that manages all techniques of RFC 1035 (compression pointer and so on) */ consumedx = get_dns_name(rfc3396_dns_domain_search_list.tvb_composite, composite_offset, tvb_reported_length(rfc3396_dns_domain_search_list.tvb_composite), 0, (const gchar **)&dns_name, &dns_name_len); - name_out = format_text(wmem_packet_scope(), dns_name, dns_name_len); + name_out = format_text(pinfo->pool, dns_name, dns_name_len); if (rfc3396_dns_domain_search_list.total_number_of_block == 1) { /* RFC 3396 is not used, so we can easily link the fqdn with v_tree. */ proto_tree_add_string(tree, hf_dhcp_option_dhcp_dns_domain_search_list_fqdn, tvb, composite_offset, consumedx, name_out); @@ -2874,10 +2874,10 @@ dissect_dhcpopt_sip_servers(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rfc3396_sip_server.index_current_block++; if (rfc3396_sip_server.total_number_of_block > 1) { proto_tree_add_string(tree, hf_dhcp_option_sip_server_rfc_3396_detected, tvb, 0, length, - wmem_strdup_printf(wmem_packet_scope(), "%u/%u", rfc3396_sip_server.index_current_block, rfc3396_sip_server.total_number_of_block)); + wmem_strdup_printf(pinfo->pool, "%u/%u", rfc3396_sip_server.index_current_block, rfc3396_sip_server.total_number_of_block)); if (rfc3396_sip_server.index_current_block != rfc3396_sip_server.total_number_of_block) { proto_tree_add_string(tree, hf_dhcp_option_sip_server_refer_last_option, tvb, 0, length, - wmem_strdup_printf(wmem_packet_scope(), "%u/%u", rfc3396_sip_server.total_number_of_block, rfc3396_sip_server.total_number_of_block)); + wmem_strdup_printf(pinfo->pool, "%u/%u", rfc3396_sip_server.total_number_of_block, rfc3396_sip_server.total_number_of_block)); } } @@ -2919,7 +2919,7 @@ dissect_dhcpopt_sip_servers(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* use the get_dns_name method that manages all techniques of RFC 1035 (compression pointer and so on) */ consumedx = get_dns_name(rfc3396_sip_server.tvb_composite, composite_offset, tvb_reported_length(rfc3396_sip_server.tvb_composite), 1 /* ignore enc */, (const gchar **)&dns_name, &dns_name_len); - name_out = format_text(wmem_packet_scope(), dns_name, dns_name_len); + name_out = format_text(pinfo->pool, dns_name, dns_name_len); if (rfc3396_sip_server.total_number_of_block == 1) { /* RFC 3396 is not used, so we can easily link the fqdn with v_tree. */ @@ -3137,7 +3137,7 @@ dissect_dhcpopt_rdnss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* get_dns_name(tvb, offset, tvb_reported_length_remaining(tvb,offset), offset, (const gchar **)&dns_name, &dns_name_len); proto_tree_add_string(tree, hf_dhcp_option_rdnss_domain, tvb, offset, - tvb_reported_length_remaining(tvb,offset), format_text(wmem_packet_scope(), dns_name, dns_name_len)); + tvb_reported_length_remaining(tvb,offset), format_text(pinfo->pool, dns_name, dns_name_len)); return tvb_captured_length(tvb); } @@ -3292,10 +3292,10 @@ dissect_dhcpopt_avaya_ip_telephone(tvbuff_t *tvb, packet_info *pinfo, proto_tree expert_add_info_format(pinfo, tree, &ei_dhcp_bad_length, "Avaya IP Telephone option length isn't >= 5"); return 1; } - avaya_ti = proto_tree_add_item_ret_string(tree, hf_dhcp_option242_avaya, tvb, offset, tvb_reported_length(tvb), ENC_ASCII|ENC_NA, wmem_packet_scope(), (const guint8 **)&avaya_option); + avaya_ti = proto_tree_add_item_ret_string(tree, hf_dhcp_option242_avaya, tvb, offset, tvb_reported_length(tvb), ENC_ASCII|ENC_NA, pinfo->pool, (const guint8 **)&avaya_option); o242avaya_v_tree = proto_item_add_subtree(avaya_ti, ett_dhcp_option242_suboption); - avaya_param_buf = wmem_strbuf_new(wmem_packet_scope(), ""); - gchar **fields = wmem_strsplit(wmem_packet_scope(), avaya_option, ",", -1); + avaya_param_buf = wmem_strbuf_new(pinfo->pool, ""); + gchar **fields = wmem_strsplit(pinfo->pool, avaya_option, ",", -1); for (int i = 0; fields[i]; i++) { const gchar *field = fields[i]; if (!strchr(field, '=')) { @@ -5404,7 +5404,7 @@ dissect_vendor_tr111_suboption(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr } else if (o125_tr111_opt[subopt].ftype == oui) { /* Get hex string. Expecting 6 characters. */ - const gchar *oui_string = (gchar *)tvb_get_string_enc(wmem_packet_scope(), tvb, offset, subopt_len, ENC_ASCII); + const gchar *oui_string = (gchar *)tvb_get_string_enc(pinfo->pool, tvb, offset, subopt_len, ENC_ASCII); /* Convert to OUI number. Only 3 bytes so no data lost in downcast. */ guint32 oui_number = (guint32)strtol(oui_string, NULL, 16); /* Add item using oui_vals */ @@ -5501,7 +5501,7 @@ dissect_vendor_cl_suboption(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree_add_item(o125_v_tree, hf_dhcp_option125_value, tvb, offset, subopt_len, ENC_NA); switch(subopt){ case 5: /* Modem Capabilities */ - dissect_docsis_cm_cap(o125_v_tree, tvb, offset-2, subopt_len+2, TRUE); + dissect_docsis_cm_cap(pinfo, o125_v_tree, tvb, offset-2, subopt_len+2, TRUE); break; } break; @@ -5938,7 +5938,7 @@ dissect_packetcable_mta_vendor_id_heur( tvbuff_t *tvb, packet_info *pinfo, proto return FALSE; } - vendor_id = tvb_get_string_enc(wmem_packet_scope(), tvb, 0, 8, ENC_ASCII|ENC_NA); + vendor_id = tvb_get_string_enc(pinfo->pool, tvb, 0, 8, ENC_ASCII|ENC_NA); if ((strcmp((const char*)vendor_id, PACKETCABLE_MTA_CAP10) == 0) || (strcmp((const char*)vendor_id, PACKETCABLE_MTA_CAP15) == 0) || (strcmp((const char*)vendor_id, PACKETCABLE_MTA_CAP20) == 0)) { @@ -6179,22 +6179,22 @@ display_uint_with_range_checking(proto_item *ti, guint8 val_byte, guint16 val_ui } } -static void get_opt125_tlv(tvbuff_t *tvb, guint off, guint8 *tlvtype, guint8 *tlvlen, guint8 **value) +static void get_opt125_tlv(wmem_allocator_t *scope, tvbuff_t *tvb, guint off, guint8 *tlvtype, guint8 *tlvlen, guint8 **value) { /* Type */ *tlvtype = tvb_get_guint8(tvb, off); /* Length */ *tlvlen = tvb_get_guint8(tvb, off+1); /* Value */ - *value = (guint8 *)tvb_memdup(wmem_packet_scope(), tvb, off + 2, *tlvlen); + *value = (guint8 *)tvb_memdup(scope, tvb, off + 2, *tlvlen); } -static void get_opt60_tlv(tvbuff_t *tvb, guint off, guint8 *tlvtype, guint8 *tlvlen, guint8 **value) +static void get_opt60_tlv(wmem_allocator_t *scope, tvbuff_t *tvb, guint off, guint8 *tlvtype, guint8 *tlvlen, guint8 **value) { guint i; guint8 *val_asc; - val_asc = (guint8 *)wmem_alloc0(wmem_packet_scope(), 4); + val_asc = (guint8 *)wmem_alloc0(scope, 4); /* Type */ tvb_memcpy(tvb, val_asc, off, 2); *tlvtype = (guint8)strtoul((gchar*)val_asc, NULL, 16); @@ -6202,7 +6202,7 @@ static void get_opt60_tlv(tvbuff_t *tvb, guint off, guint8 *tlvtype, guint8 *tlv tvb_memcpy(tvb, val_asc, off + 2, 2); *tlvlen = (guint8)strtoul((gchar*)val_asc, NULL, 16); /* Value */ - *value = (guint8 *)wmem_alloc0(wmem_packet_scope(), *tlvlen); + *value = (guint8 *)wmem_alloc0(scope, *tlvlen); for (i=0; i<*tlvlen; i++) { memset(val_asc, 0, 4); @@ -6212,7 +6212,7 @@ static void get_opt60_tlv(tvbuff_t *tvb, guint off, guint8 *tlvtype, guint8 *tlv } static void -dissect_docsis_cm_cap(proto_tree *v_tree, tvbuff_t *tvb, int voff, int len, gboolean opt125) +dissect_docsis_cm_cap(packet_info *pinfo, proto_tree *v_tree, tvbuff_t *tvb, int voff, int len, gboolean opt125) { guint8 *asc_val; proto_item *ti; @@ -6259,7 +6259,7 @@ dissect_docsis_cm_cap(proto_tree *v_tree, tvbuff_t *tvb, int voff, int len, gboo if (opt125) { - get_opt125_tlv(tvb, off, &tlv_type, &tlv_len, &val_other); + get_opt125_tlv(pinfo->pool, tvb, off, &tlv_type, &tlv_len, &val_other); ti = proto_tree_add_uint_format(v_tree, hf_dhcp_docsis_cm_cap_type, tvb, off, tlv_len + 2, tlv_type, @@ -6272,7 +6272,7 @@ dissect_docsis_cm_cap(proto_tree *v_tree, tvbuff_t *tvb, int voff, int len, gboo /* Option 60 is formatted as an ASCII string. Since the capabilities are the same for both options I am converting the Option 60 values from ASCII to uint8s to allow the same parser to work for both */ - get_opt60_tlv(tvb, off, &tlv_type, &tlv_len, &val_other); + get_opt60_tlv(pinfo->pool, tvb, off, &tlv_type, &tlv_len, &val_other); ti = proto_tree_add_uint_format(v_tree, hf_dhcp_docsis_cm_cap_type, tvb, off, (tlv_len * 2) + 4, tlv_type, @@ -6541,7 +6541,7 @@ dissect_docsis_cm_cap(proto_tree *v_tree, tvbuff_t *tvb, int voff, int len, gboo } static gboolean -dissect_packetcable_cm_vendor_id_heur( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_ ) +dissect_packetcable_cm_vendor_id_heur( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ ) { guint8* vendor_id; @@ -6549,10 +6549,10 @@ dissect_packetcable_cm_vendor_id_heur( tvbuff_t *tvb, packet_info *pinfo _U_, pr return FALSE; } - vendor_id = tvb_get_string_enc(wmem_packet_scope(), tvb, 0, 10, ENC_ASCII|ENC_NA); + vendor_id = tvb_get_string_enc(pinfo->pool, tvb, 0, 10, ENC_ASCII|ENC_NA); if ((strcmp((const char*)vendor_id, PACKETCABLE_CM_CAP11) == 0) || (strcmp((const char*)vendor_id, PACKETCABLE_CM_CAP20) == 0)) { - dissect_docsis_cm_cap(tree, tvb, 0, tvb_reported_length(tvb), FALSE); + dissect_docsis_cm_cap(pinfo, tree, tvb, 0, tvb_reported_length(tvb), FALSE); return TRUE; } @@ -6824,7 +6824,7 @@ dissect_packetcable_ietf_ccc(packet_info *pinfo, proto_item *v_ti, proto_tree *v case 0: get_dns_name(tvb, suboptoff, subopt_len, suboptoff, (const char **)&dns_name, &dns_name_len); - proto_item_append_text(vti, "%s (%u byte%s)", format_text(wmem_packet_scope(), dns_name, dns_name_len), + proto_item_append_text(vti, "%s (%u byte%s)", format_text(pinfo->pool, dns_name, dns_name_len), subopt_len - 1, plurality(subopt_len, "", "s") ); break; @@ -6882,7 +6882,7 @@ dissect_packetcable_ietf_ccc(packet_info *pinfo, proto_item *v_ti, proto_tree *v case PKT_CCC_KRB_REALM: /* String values */ get_dns_name(tvb, suboptoff, subopt_len, suboptoff, (const gchar **)&dns_name, &dns_name_len); - proto_item_append_text(vti, "%s (%u byte%s)", format_text(wmem_packet_scope(), dns_name, dns_name_len), + proto_item_append_text(vti, "%s (%u byte%s)", format_text(pinfo->pool, dns_name, dns_name_len), subopt_len, plurality(subopt_len, "", "s") ); suboptoff += subopt_len; break; @@ -7029,12 +7029,12 @@ dissect_dhcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ if ((htype == ARPHRD_ETHER || htype == ARPHRD_IEEE802) && hlen == 6) { col_add_fstr(pinfo->cinfo, COL_INFO, "Boot Request from %s (%s)", - tvb_arphrdaddr_to_str(tvb, 28, hlen, htype), + tvb_arphrdaddr_to_str(pinfo->pool, tvb, 28, hlen, htype), tvb_get_ether_name(tvb, 28)); } else { col_add_fstr(pinfo->cinfo, COL_INFO, "Boot Request from %s", - tvb_arphrdaddr_to_str(tvb, 28, hlen, htype)); + tvb_arphrdaddr_to_str(pinfo->pool, tvb, 28, hlen, htype)); } break; @@ -7147,7 +7147,7 @@ dissect_dhcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ /* The chaddr element is 16 bytes in length, although only the first hlen bytes are used */ proto_tree_add_bytes_format_value(bp_tree, hf_dhcp_hw_addr, tvb, 28, 16, - NULL, "%s", tvb_arphrdaddr_to_str(tvb, 28, hlen, htype)); + NULL, "%s", tvb_arphrdaddr_to_str(pinfo->pool, tvb, 28, hlen, htype)); if ((16 - hlen) > 0) proto_tree_add_item(bp_tree, hf_dhcp_hw_addr_padding, tvb, 28+hlen, 16-hlen, ENC_NA); } else { diff --git a/epan/dissectors/packet-dhcpv6.c b/epan/dissectors/packet-dhcpv6.c index c097a14890..7fe971f74d 100644 --- a/epan/dissectors/packet-dhcpv6.c +++ b/epan/dissectors/packet-dhcpv6.c @@ -1894,7 +1894,7 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree, if (optlen > 8) { hwtype = tvb_get_ntohs(tvb, off + 2); proto_tree_add_string(subtree, hf_duidllt_link_layer_addr, tvb, off + 8, - optlen - 8, tvb_arphrdaddr_to_str(tvb, off+8, optlen-8, hwtype)); + optlen - 8, tvb_arphrdaddr_to_str(pinfo->pool, tvb, off+8, optlen-8, hwtype)); } } break; @@ -1917,7 +1917,7 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree, if (optlen > 4) { hwtype = tvb_get_ntohs(tvb, off + 2); proto_tree_add_string(subtree, hf_duidll_link_layer_addr, tvb, off + 4, - optlen - 4, tvb_arphrdaddr_to_str(tvb, off+4, optlen-4, hwtype)); + optlen - 4, tvb_arphrdaddr_to_str(pinfo->pool, tvb, off+4, optlen-4, hwtype)); } break; case DUID_UUID: @@ -2142,7 +2142,7 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree, break; } proto_tree_add_string(subtree, hf_iaid, tvb, off, - 4, tvb_arphrdaddr_to_str(tvb, off, 4, opttype)); /* XXX: IAID is opaque ? review ... */ + 4, tvb_arphrdaddr_to_str(pinfo->pool, tvb, off, 4, opttype)); /* XXX: IAID is opaque ? review ... */ if (tvb_get_ntohl(tvb, off+4) == DHCPV6_LEASEDURATION_INFINITY) { proto_tree_add_uint_format_value(subtree, hf_iaid_t1, tvb, off+4, 4, DHCPV6_LEASEDURATION_INFINITY, "infinity"); @@ -2175,7 +2175,7 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree, break; } proto_tree_add_string(subtree, hf_iata, tvb, off, - 4, tvb_arphrdaddr_to_str(tvb, off, 4, opttype)); /* XXX: IAID is opaque ? review ... */ + 4, tvb_arphrdaddr_to_str(pinfo->pool, tvb, off, 4, opttype)); /* XXX: IAID is opaque ? review ... */ temp_optlen = 4; while ((optlen - temp_optlen) > 0) { temp_optlen += dhcpv6_option(tvb, pinfo, subtree, @@ -2343,7 +2343,7 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree, temp_optlen = optlen - namelen; off += namelen; if (temp_optlen >= 6) - proto_tree_add_string(subtree, hf_cablelabs_interface_id_link_address, tvb, off, temp_optlen, tvb_arphrdaddr_to_str(tvb, off, 6, ARPHRD_ETHER)); + proto_tree_add_string(subtree, hf_cablelabs_interface_id_link_address, tvb, off, temp_optlen, tvb_arphrdaddr_to_str(pinfo->pool, tvb, off, 6, ARPHRD_ETHER)); } } else { proto_tree_add_item(subtree, hf_interface_id, tvb, off, optlen, ENC_NA); diff --git a/epan/dissectors/packet-elasticsearch.c b/epan/dissectors/packet-elasticsearch.c index b0d90ee52e..d6b5336167 100644 --- a/epan/dissectors/packet-elasticsearch.c +++ b/epan/dissectors/packet-elasticsearch.c @@ -166,7 +166,7 @@ static vint_t read_vint(tvbuff_t *tvb, int offset){ return vint; } -static vstring_t read_vstring(tvbuff_t *tvb, int offset) { +static vstring_t read_vstring(wmem_allocator_t *scope, tvbuff_t *tvb, int offset) { vstring_t vstring; int string_starting_offset; int string_length; @@ -175,7 +175,7 @@ static vstring_t read_vstring(tvbuff_t *tvb, int offset) { string_starting_offset = offset + vstring.vint_length.length; string_length = vstring.vint_length.value; - vstring.value = tvb_get_string_enc(wmem_packet_scope(), tvb, string_starting_offset, string_length, ENC_UTF_8); + vstring.value = tvb_get_string_enc(scope, tvb, string_starting_offset, string_length, ENC_UTF_8); vstring.length = string_length + vstring.vint_length.length; return vstring; @@ -230,7 +230,7 @@ static int elasticsearch_partial_dissect_address(tvbuff_t *tvb, packet_info *pin break; case ADDRESS_FORMAT_STRING: - address_name = read_vstring(tvb, offset); + address_name = read_vstring(pinfo->pool, tvb, offset); proto_tree_add_string(address_tree, hf_elasticsearch_address_name, tvb, offset, address_name.length, address_name.value); offset += address_name.length; break; @@ -303,7 +303,7 @@ static int dissect_elasticsearch_zen_ping(tvbuff_t *tvb, packet_info *pinfo, pro offset += 4; /* Cluster name */ - cluster_name = read_vstring(tvb, offset); + cluster_name = read_vstring(pinfo->pool, tvb, offset); proto_tree_add_string(elasticsearch_tree, hf_elasticsearch_cluster_name, tvb, offset, cluster_name.length, cluster_name.value); col_append_fstr(pinfo->cinfo, COL_INFO, "cluster=%s", cluster_name.value); offset += cluster_name.length; @@ -313,7 +313,7 @@ static int dissect_elasticsearch_zen_ping(tvbuff_t *tvb, packet_info *pinfo, pro discovery_node_tree = proto_tree_add_subtree(elasticsearch_tree, tvb, offset, -1, ett_elasticsearch_discovery_node, &discovery_node_item, "Node" ); /* Node name */ - node_name = read_vstring(tvb, offset); + node_name = read_vstring(pinfo->pool, tvb, offset); proto_tree_add_string(discovery_node_tree, hf_elasticsearch_node_name, tvb, offset, node_name.length, node_name.value); col_append_fstr(pinfo->cinfo, COL_INFO, ", name=%s", node_name.value); offset += node_name.length; @@ -322,17 +322,17 @@ static int dissect_elasticsearch_zen_ping(tvbuff_t *tvb, packet_info *pinfo, pro /* Node ID */ - node_id = read_vstring(tvb, offset); + node_id = read_vstring(pinfo->pool, tvb, offset); proto_tree_add_string(discovery_node_tree, hf_elasticsearch_node_id, tvb, offset, node_id.length, node_id.value); offset += node_id.length; /* Hostname */ - host_name = read_vstring(tvb, offset); + host_name = read_vstring(pinfo->pool, tvb, offset); proto_tree_add_string(discovery_node_tree, hf_elasticsearch_host_name, tvb, offset, host_name.length, host_name.value); offset += host_name.length; /* Host address */ - host_address = read_vstring(tvb, offset); + host_address = read_vstring(pinfo->pool, tvb, offset); proto_tree_add_string(discovery_node_tree, hf_elasticsearch_host_address, tvb, offset, host_address.length, host_address.value); offset += host_address.length; @@ -386,13 +386,13 @@ static void elasticsearch_decode_binary_request(tvbuff_t *tvb, packet_info *pinf features = read_vint(tvb, offset); offset += features.length; for (i = 0; i < features.value; i++) { - feature = read_vstring(tvb, offset); + feature = read_vstring(pinfo->pool, tvb, offset); proto_tree_add_string(tree, hf_elasticsearch_feature, tvb, offset, feature.length, feature.value); offset += feature.length; } } - action = read_vstring(tvb, offset); + action = read_vstring(pinfo->pool, tvb, offset); proto_tree_add_string(tree, hf_elasticsearch_action, tvb, offset, action.length, action.value); col_append_fstr(pinfo->cinfo, COL_INFO, "action=%s, ", action.value); offset += action.length; @@ -485,8 +485,8 @@ static int elasticsearch_dissect_valid_binary_packet(tvbuff_t *tvb, packet_info request_headers = read_vint(tvb, offset); offset += request_headers.length; for (i = 0; i < request_headers.value; i++) { - header_key = read_vstring(tvb, offset); - header_value = read_vstring(tvb, offset + header_key.length); + header_key = read_vstring(pinfo->pool, tvb, offset); + header_value = read_vstring(pinfo->pool, tvb, offset + header_key.length); header_item = proto_tree_add_item(tree, hf_elasticsearch_header_request, tvb, offset, header_key.length + header_value.length, ENC_NA); header_tree = proto_item_add_subtree(header_item, ett_elasticsearch_header); @@ -507,7 +507,7 @@ static int elasticsearch_dissect_valid_binary_packet(tvbuff_t *tvb, packet_info header_item = proto_tree_add_item(tree, hf_elasticsearch_header_response, tvb, offset, 0, ENC_NA); header_tree = proto_item_add_subtree(header_item, ett_elasticsearch_header); - header_key = read_vstring(tvb, offset); + header_key = read_vstring(pinfo->pool, tvb, offset); proto_tree_add_string(header_tree, hf_elasticsearch_header_key, tvb, offset, header_key.length, header_key.value); proto_item_append_text(header_item, ": %s", header_key.value); offset += header_key.length; @@ -516,7 +516,7 @@ static int elasticsearch_dissect_valid_binary_packet(tvbuff_t *tvb, packet_info offset += header_values.length; for (j = 0; j < header_values.value; j++) { - header_value = read_vstring(tvb, offset); + header_value = read_vstring(pinfo->pool, tvb, offset); proto_tree_add_string(header_tree, hf_elasticsearch_header_value, tvb, offset, header_value.length, header_value.value); proto_item_append_text(header_item, j > 0 ? ", %s" : "%s", header_value.value); offset += header_value.length; diff --git a/epan/dissectors/packet-gtp.c b/epan/dissectors/packet-gtp.c index 7a6ab5eb36..398e7c0946 100644 --- a/epan/dissectors/packet-gtp.c +++ b/epan/dissectors/packet-gtp.c @@ -4714,7 +4714,7 @@ decode_gtp_16(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree if (g_gtp_session && !PINFO_FD_VISITED(pinfo)) { args->last_teid = teid_data; /* We save it to track the error indication */ if (!teid_exists(teid_data, args->teid_list)) { - teid = wmem_new(wmem_packet_scope(), guint32); + teid = wmem_new(pinfo->pool, guint32); *teid = teid_data; wmem_list_prepend(args->teid_list, teid); } @@ -4749,7 +4749,7 @@ decode_gtp_17(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree /* We save the teid_cp so that we could assignate its corresponding session ID later */ if (g_gtp_session && !PINFO_FD_VISITED(pinfo)) { if (!teid_exists(teid_cp, args->teid_list)) { - teid = wmem_new(wmem_packet_scope(), guint32); + teid = wmem_new(pinfo->pool, guint32); *teid = teid_cp; wmem_list_prepend(args->teid_list, teid); } @@ -5990,11 +5990,11 @@ static const gchar * dissect_radius_qos_umts(proto_tree * tree, tvbuff_t * tvb, packet_info* pinfo) { decode_qos_umts(tvb, 0, pinfo, tree, "UMTS GTP QoS Profile", 3); - return tvb_get_string_enc(wmem_packet_scope(), tvb, 0, tvb_reported_length(tvb), ENC_UTF_8|ENC_NA); + return tvb_get_string_enc(pinfo->pool, tvb, 0, tvb_reported_length(tvb), ENC_UTF_8|ENC_NA); } static void -decode_apn(tvbuff_t * tvb, int offset, guint16 length, proto_tree * tree, proto_item *item) +decode_apn(packet_info *pinfo, tvbuff_t * tvb, int offset, guint16 length, proto_tree * tree, proto_item *item) { const guint8 *apn = NULL; @@ -6007,7 +6007,7 @@ decode_apn(tvbuff_t * tvb, int offset, guint16 length, proto_tree * tree, proto_ */ /* Highlight bytes including the first length byte */ - proto_tree_add_item_ret_string(tree, hf_gtp_apn, tvb, offset, length, ENC_APN_STR, wmem_packet_scope(), &apn); + proto_tree_add_item_ret_string(tree, hf_gtp_apn, tvb, offset, length, ENC_APN_STR, pinfo->pool, &apn); if(item){ proto_item_append_text(item, ": %s", apn); } @@ -6045,7 +6045,7 @@ decode_fqdn(tvbuff_t * tvb, int offset, guint16 length, proto_tree * tree, sessi * TODO: unify addr functions */ static int -decode_gtp_pdp_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_) +decode_gtp_pdp_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_) { guint8 ggsn_addr_len, apn_len, trans_id, ea; @@ -6163,7 +6163,7 @@ decode_gtp_pdp_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_ apn_len = tvb_get_guint8(tvb, offset); proto_tree_add_item(ext_tree_pdp, hf_gtp_apn_length, tvb, offset, 1, ENC_BIG_ENDIAN); - decode_apn(tvb, offset + 1, apn_len, ext_tree_pdp, NULL); + decode_apn(pinfo, tvb, offset + 1, apn_len, ext_tree_pdp, NULL); offset = offset + 1 + apn_len; /* @@ -6206,7 +6206,7 @@ decode_gtp_pdp_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_ * UMTS: 29.060, v4.0, chapter 7.7.30 */ static int -decode_gtp_apn(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_) +decode_gtp_apn(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_) { guint16 length; @@ -6219,7 +6219,7 @@ decode_gtp_apn(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * val_to_str_ext_const(GTP_EXT_APN, >p_val_ext, "Unknown field")); proto_tree_add_item(ext_tree_apn, hf_gtp_apn_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN); - decode_apn(tvb, offset + 3, length, ext_tree_apn, te); + decode_apn(pinfo, tvb, offset + 3, length, ext_tree_apn, te); return 3 + length; } @@ -6261,7 +6261,7 @@ decode_gtp_proto_conf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tre * UMTS: 29.060 v4.0, chapter 7.7.32 */ static int -decode_gtp_gsn_addr_common(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args, const char * tree_name, int hf_ipv4, int hf_ipv6) +decode_gtp_gsn_addr_common(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args, const char * tree_name, int hf_ipv4, int hf_ipv6) { guint8 addr_type, addr_len; @@ -6273,7 +6273,7 @@ decode_gtp_gsn_addr_common(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, length = tvb_get_ntohs(tvb, offset + 1); ext_tree_gsn_addr = proto_tree_add_subtree_format(tree, tvb, offset, 3 + length, ett_gtp_gsn_addr, &te, "%s : ", tree_name); - gsn_address = wmem_new0(wmem_packet_scope(), address); + gsn_address = wmem_new0(pinfo->pool, address); switch (length) { case 4: proto_tree_add_item(ext_tree_gsn_addr, hf_gtp_gsn_address_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN); @@ -6322,7 +6322,7 @@ decode_gtp_gsn_addr_common(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, if (g_gtp_session && gtp_version == 1 && !PINFO_FD_VISITED(pinfo)) { if (!ip_exists(*gsn_address, args->ip_list)) { - copy_address_wmem(wmem_packet_scope(), &args->last_ip, gsn_address); + copy_address_wmem(pinfo->pool, &args->last_ip, gsn_address); wmem_list_prepend(args->ip_list, gsn_address); } } @@ -7090,7 +7090,7 @@ decode_gtp_ms_time_zone(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, pro * Type = 154 (Decimal) */ static int -decode_gtp_imeisv(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_) +decode_gtp_imeisv(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_) { guint16 length; @@ -7114,7 +7114,7 @@ decode_gtp_imeisv(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tre * set to '1111'. Both IMEI and IMEISV are BCD encoded. */ next_tvb = tvb_new_subset_length(tvb, offset, length); - proto_tree_add_item_ret_display_string(ext_imeisv, hf_gtp_ext_imeisv, next_tvb, 0, -1, ENC_BCD_DIGITS_0_9, wmem_packet_scope(), &digit_str); + proto_tree_add_item_ret_display_string(ext_imeisv, hf_gtp_ext_imeisv, next_tvb, 0, -1, ENC_BCD_DIGITS_0_9, pinfo->pool, &digit_str); proto_item_append_text(te, ": %s", digit_str); return 3 + length; @@ -7213,7 +7213,7 @@ decode_gtp_mbms_ue_ctx(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, prot proto_tree_add_item_ret_uint(ext_tree, hf_gtp_apn_length, tvb, offset, 1, ENC_BIG_ENDIAN, &apn_len); offset++; - decode_apn(tvb, offset, apn_len, ext_tree, NULL); + decode_apn(pinfo, tvb, offset, apn_len, ext_tree, NULL); offset += apn_len; /* * The Transaction Identifier is the 4 or 12 bit Transaction Identifier used in the 3GPP TS 24.008 [5] Session Management @@ -9347,7 +9347,7 @@ decode_gtp_ciot_opt_sup_ind(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, * 7.7.121 SCEF PDN Connection */ static int -decode_gtp_scef_pdn_conn(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_) +decode_gtp_scef_pdn_conn(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_) { guint16 length; proto_tree *ext_tree; @@ -9363,7 +9363,7 @@ decode_gtp_scef_pdn_conn(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, pr offset += 2; proto_tree_add_item_ret_uint(ext_tree, hf_gtp_apn_length, tvb, offset, 1, ENC_NA, &apn_length); - decode_apn(tvb, offset + 1, (guint16)apn_length, ext_tree, NULL); + decode_apn(pinfo, tvb, offset + 1, (guint16)apn_length, ext_tree, NULL); offset += 1 + apn_length; @@ -10225,7 +10225,7 @@ dissect_gtp_common(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) /* Setting everything to 0, so that the TEID is 0 for GTP version 0 * The magic number should perhaps be replaced. */ - gtp_hdr = wmem_new0(wmem_packet_scope(), gtp_hdr_t); + gtp_hdr = wmem_new0(pinfo->pool, gtp_hdr_t); /* Setting the TEID to -1 to say that the TEID is not valid for this packet */ gtp_hdr->teid = -1; @@ -10234,11 +10234,11 @@ dissect_gtp_common(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) col_clear(pinfo->cinfo, COL_INFO); if (g_gtp_session) { - args = wmem_new0(wmem_packet_scope(), session_args_t); + args = wmem_new0(pinfo->pool, session_args_t); args->last_cause = 128; /* It stores the last cause decoded. Cause accepted by default */ /* We create the auxiliary lists */ - args->teid_list = wmem_list_new(wmem_packet_scope()); - args->ip_list = wmem_list_new(wmem_packet_scope()); + args->teid_list = wmem_list_new(pinfo->pool); + args->ip_list = wmem_list_new(pinfo->pool); } /* diff --git a/epan/dissectors/packet-igrp.c b/epan/dissectors/packet-igrp.c index ebd7e9f192..c4419447c8 100644 --- a/epan/dissectors/packet-igrp.c +++ b/epan/dissectors/packet-igrp.c @@ -53,7 +53,7 @@ static gint ett_igrp_net = -1; static expert_field ei_igrp_version = EI_INIT; -static void dissect_vektor_igrp (tvbuff_t *tvb, proto_tree *igrp_vektor_tree, guint8 network); +static void dissect_vektor_igrp (packet_info *pinfo, tvbuff_t *tvb, proto_tree *igrp_vektor_tree, guint8 network); static int dissect_igrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { @@ -117,7 +117,7 @@ static int dissect_igrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi for( ; ninterior>0 ; ninterior-- ) { igrp_vektor_tree = proto_item_add_subtree(ti,ett_igrp_vektor); next_tvb = tvb_new_subset_length_caplen(tvb, offset, IGRP_ENTRY_LENGTH, -1); - dissect_vektor_igrp (next_tvb,igrp_vektor_tree,network); + dissect_vektor_igrp (pinfo,next_tvb,igrp_vektor_tree,network); offset+=IGRP_ENTRY_LENGTH; } @@ -125,7 +125,7 @@ static int dissect_igrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi for( ; nsystem>0 ; nsystem-- ) { igrp_vektor_tree = proto_item_add_subtree(ti,ett_igrp_vektor); next_tvb = tvb_new_subset_length_caplen(tvb, offset, IGRP_ENTRY_LENGTH, -1); - dissect_vektor_igrp (next_tvb,igrp_vektor_tree,0); + dissect_vektor_igrp (pinfo,next_tvb,igrp_vektor_tree,0); offset+=IGRP_ENTRY_LENGTH; } @@ -133,7 +133,7 @@ static int dissect_igrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi for( ; nexterior>0 ; nexterior-- ) { igrp_vektor_tree = proto_item_add_subtree(ti,ett_igrp_vektor); next_tvb = tvb_new_subset_length_caplen(tvb, offset, IGRP_ENTRY_LENGTH, -1); - dissect_vektor_igrp (next_tvb,igrp_vektor_tree,0); + dissect_vektor_igrp (pinfo,next_tvb,igrp_vektor_tree,0); offset+=IGRP_ENTRY_LENGTH; } @@ -142,7 +142,7 @@ static int dissect_igrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi return tvb_captured_length(tvb); } -static void dissect_vektor_igrp (tvbuff_t *tvb, proto_tree *igrp_vektor_tree, guint8 network) +static void dissect_vektor_igrp (packet_info *pinfo, tvbuff_t *tvb, proto_tree *igrp_vektor_tree, guint8 network) { union { guint8 addr_bytes[4]; @@ -172,7 +172,7 @@ static void dissect_vektor_igrp (tvbuff_t *tvb, proto_tree *igrp_vektor_tree, gu set_address(&ip_addr, AT_IPv4, 4, &addr); igrp_vektor_tree = proto_tree_add_subtree_format(igrp_vektor_tree, tvb, 0 ,14, - ett_igrp_net, NULL, "Entry for network %s", address_to_str(wmem_packet_scope(), &ip_addr)); + ett_igrp_net, NULL, "Entry for network %s", address_to_str(pinfo->pool, &ip_addr)); proto_tree_add_ipv4(igrp_vektor_tree, hf_igrp_network, tvb, 0, 3, addr.addr_word); proto_tree_add_item(igrp_vektor_tree, hf_igrp_delay, tvb, 3, 3, ENC_BIG_ENDIAN); proto_tree_add_item(igrp_vektor_tree, hf_igrp_bandwidth, tvb, 6, 3, ENC_BIG_ENDIAN); diff --git a/epan/dissectors/packet-ncsi.c b/epan/dissectors/packet-ncsi.c index b826a90d8f..88ee07aa9b 100644 --- a/epan/dissectors/packet-ncsi.c +++ b/epan/dissectors/packet-ncsi.c @@ -512,7 +512,7 @@ dissect_ncsi_aen(tvbuff_t *tvb, proto_tree *tree) #define HEXSTR(x) (((x) < 10)? '0' + (x): 'A' + ((x) - 10)) static const gchar * -ncsi_bcd_dig_to_str(tvbuff_t *tvb, const gint offset) +ncsi_bcd_dig_to_str(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset) { guint8 octet; int i; @@ -549,13 +549,13 @@ ncsi_bcd_dig_to_str(tvbuff_t *tvb, const gint offset) } digit_str[str_offset] = '\0'; - return get_utf_8_string(wmem_packet_scope(), digit_str, (int)strlen(digit_str)); + return get_utf_8_string(scope, digit_str, (int)strlen(digit_str)); } static const gchar * -ncsi_fw_version(tvbuff_t *tvb, const gint offset) +ncsi_fw_version(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset) { int length = 16; /* hh.hh.hh.hh */ guint8 octet; @@ -564,7 +564,7 @@ ncsi_fw_version(tvbuff_t *tvb, const gint offset) int str_offset = 0; - ver_str = (char *)wmem_alloc(wmem_packet_scope(), length); + ver_str = (char *)wmem_alloc(scope, length); for (i = 0 ; i < 4; i++) { octet = tvb_get_guint8(tvb, offset + i); @@ -909,12 +909,12 @@ dissect_ncsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, ncsi_ver_tree = proto_tree_add_subtree(ncsi_payload_tree, tvb, 20, plen - 4, ett_ncsi_payload, NULL, "Version ID"); - ver_str = ncsi_bcd_dig_to_str(tvb, 20); + ver_str = ncsi_bcd_dig_to_str(pinfo->pool, tvb, 20); proto_tree_add_string(ncsi_ver_tree, hf_ncsi_ver, tvb, 20, 8, ver_str); fw_name = tvb_get_string_enc(pinfo->pool, tvb, 28, 12, ENC_ASCII); proto_tree_add_string(ncsi_ver_tree, hf_ncsi_fw_name, tvb, 28, 12, fw_name); - proto_tree_add_string(ncsi_ver_tree, hf_ncsi_fw_ver, tvb, 40, 4, ncsi_fw_version(tvb, 40)); + proto_tree_add_string(ncsi_ver_tree, hf_ncsi_fw_ver, tvb, 40, 4, ncsi_fw_version(pinfo->pool, tvb, 40)); vid = tvb_get_guint16(tvb, 46, ENC_BIG_ENDIAN); did = tvb_get_guint16(tvb, 44, ENC_BIG_ENDIAN); diff --git a/epan/dissectors/packet-pim.c b/epan/dissectors/packet-pim.c index 9ac0bc663c..02e9407979 100644 --- a/epan/dissectors/packet-pim.c +++ b/epan/dissectors/packet-pim.c @@ -757,7 +757,7 @@ dissect_pimv1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U } static gboolean -dissect_pim_addr(proto_tree* tree, tvbuff_t *tvb, int offset, enum pimv2_addrtype at, +dissect_pim_addr(packet_info *pinfo, proto_tree* tree, tvbuff_t *tvb, int offset, enum pimv2_addrtype at, const char* label, proto_item** ret_item, int hf_ip4, int hf_ip6, int *advance) { guint8 af, et, flags, mask_len, ja_af; ws_in6_addr ipv6; @@ -803,7 +803,7 @@ dissect_pim_addr(proto_tree* tree, tvbuff_t *tvb, int offset, enum pimv2_addrtyp if (label) { ti = proto_tree_add_ipv4_format(tree, hf_ip4, tvb, offset, 2 + len, - ipv4, "%s: %s", label, tvb_ip_to_str(wmem_packet_scope(), tvb, offset + 2)); + ipv4, "%s: %s", label, tvb_ip_to_str(pinfo->pool, tvb, offset + 2)); } else { @@ -817,7 +817,7 @@ dissect_pim_addr(proto_tree* tree, tvbuff_t *tvb, int offset, enum pimv2_addrtyp if (label) { ti = proto_tree_add_ipv6_format(tree, hf_ip6, tvb, offset, 2 + len, - &ipv6, "%s: %s", label, tvb_ip6_to_str(wmem_packet_scope(), tvb, offset + 2)); + &ipv6, "%s: %s", label, tvb_ip6_to_str(pinfo->pool, tvb, offset + 2)); } else { @@ -858,14 +858,14 @@ dissect_pim_addr(proto_tree* tree, tvbuff_t *tvb, int offset, enum pimv2_addrtyp switch(ja_af) { case AFNUM_INET: rloc_tree = proto_tree_add_ipv4_format(ja_tree, hf_ip4, tvb, ja_offset, ja_length, - ipv4, "RLOC: %s", tvb_ip_to_str(wmem_packet_scope(), tvb, ja_offset+ 1)); + ipv4, "RLOC: %s", tvb_ip_to_str(pinfo->pool, tvb, ja_offset+ 1)); rloc_sub_tree = proto_item_add_subtree(rloc_tree, ett_pim); proto_tree_add_item(rloc_sub_tree, hf_pim_addr_af, tvb, ja_offset, 1, ENC_NA); proto_tree_add_item(rloc_sub_tree, hf_pim_rloc_addr_ipv4, tvb, ja_offset + 1, 4, ENC_BIG_ENDIAN); break; case AFNUM_INET6: rloc_tree = proto_tree_add_ipv6_format(ja_tree, hf_ip6, tvb, ja_offset, ja_length, - &ipv6, "RLOC: %s", tvb_ip_to_str(wmem_packet_scope(), tvb, ja_offset+ 1)); + &ipv6, "RLOC: %s", tvb_ip_to_str(pinfo->pool, tvb, ja_offset+ 1)); rloc_sub_tree = proto_item_add_subtree(rloc_tree, ett_pim); proto_tree_add_item(rloc_sub_tree, hf_pim_addr_af, tvb, ja_offset, 1, ENC_NA); proto_tree_add_item(rloc_sub_tree, hf_pim_rloc_addr_ipv6, tvb, ja_offset + 1, 16, ENC_NA); @@ -893,7 +893,7 @@ dissect_pim_addr(proto_tree* tree, tvbuff_t *tvb, int offset, enum pimv2_addrtyp if (label) { ti = proto_tree_add_ipv4_format(tree, hf_ip4, tvb, offset, 4 + len, - ipv4, "%s: %s", label, tvb_ip_to_str(wmem_packet_scope(), tvb, offset + 4)); + ipv4, "%s: %s", label, tvb_ip_to_str(pinfo->pool, tvb, offset + 4)); } else { @@ -909,7 +909,7 @@ dissect_pim_addr(proto_tree* tree, tvbuff_t *tvb, int offset, enum pimv2_addrtyp if (label) { ti = proto_tree_add_ipv6_format(tree, hf_ip6, tvb, offset, 4 + len, - &ipv6, "%s: %s", label, tvb_ip6_to_str(wmem_packet_scope(), tvb, offset + 4)); + &ipv6, "%s: %s", label, tvb_ip6_to_str(pinfo->pool, tvb, offset + 4)); } else { @@ -945,12 +945,12 @@ dissect_pim_addr(proto_tree* tree, tvbuff_t *tvb, int offset, enum pimv2_addrtyp if (label) { ti = proto_tree_add_ipv4_format(tree, hf_ip4, tvb, offset, 4 + len, - ipv4, "%s: %s", label, tvb_ip_to_str(wmem_packet_scope(), tvb, offset + 4)); + ipv4, "%s: %s", label, tvb_ip_to_str(pinfo->pool, tvb, offset + 4)); } else { ti = proto_tree_add_ipv4_format_value(tree, hf_ip4, tvb, offset, 4 + len, ipv4, - "%s", tvb_ip_to_str(wmem_packet_scope(), tvb, offset + 4)); + "%s", tvb_ip_to_str(pinfo->pool, tvb, offset + 4)); } proto_item_append_text(ti, "/%u", mask_len); break; @@ -961,12 +961,12 @@ dissect_pim_addr(proto_tree* tree, tvbuff_t *tvb, int offset, enum pimv2_addrtyp if (label) { ti = proto_tree_add_ipv6_format(tree, hf_ip6, tvb, offset, 4 + len, - &ipv6, "%s: %s", label, tvb_ip6_to_str(wmem_packet_scope(), tvb, offset + 4)); + &ipv6, "%s: %s", label, tvb_ip6_to_str(pinfo->pool, tvb, offset + 4)); } else { ti = proto_tree_add_ipv6_format_value(tree, hf_ip6, tvb, offset, 4 + len, &ipv6, - "%s", tvb_ip6_to_str(wmem_packet_scope(), tvb, offset + 4)); + "%s", tvb_ip6_to_str(pinfo->pool, tvb, offset + 4)); } proto_item_append_text(ti, "/%u", mask_len); break; @@ -1009,7 +1009,7 @@ dissect_pim_addr(proto_tree* tree, tvbuff_t *tvb, int offset, enum pimv2_addrtyp case PIM_JOIN_ATTRIBUTE_TYPE_RPF: if ((ja_length == 6) || (ja_length == 18)) { int advance_attr; - if (!dissect_pim_addr(ja_tree, tvb, ja_offset, pimv2_unicast, NULL, NULL, + if (!dissect_pim_addr(pinfo, ja_tree, tvb, ja_offset, pimv2_unicast, NULL, NULL, hf_pim_unicast_addr_ipv4, hf_pim_unicast_addr_ipv6, &advance_attr)) break; } else { @@ -1021,14 +1021,14 @@ dissect_pim_addr(proto_tree* tree, tvbuff_t *tvb, int offset, enum pimv2_addrtyp switch(ja_af) { case AFNUM_INET: rloc_tree = proto_tree_add_ipv4_format(ja_tree, hf_ip4, tvb, ja_offset, ja_length, - ipv4, "RLOC: %s", tvb_ip_to_str(wmem_packet_scope(), tvb, ja_offset+ 1)); + ipv4, "RLOC: %s", tvb_ip_to_str(pinfo->pool, tvb, ja_offset+ 1)); rloc_sub_tree = proto_item_add_subtree(rloc_tree, ett_pim); proto_tree_add_item(rloc_sub_tree, hf_pim_addr_af, tvb, ja_offset, 1, ENC_NA); proto_tree_add_item(rloc_sub_tree, hf_pim_rloc_addr_ipv4, tvb, ja_offset + 1, 4, ENC_BIG_ENDIAN); break; case AFNUM_INET6: rloc_tree = proto_tree_add_ipv6_format(ja_tree, hf_ip6, tvb, ja_offset, ja_length, - &ipv6, "RLOC: %s", tvb_ip_to_str(wmem_packet_scope(), tvb, ja_offset+ 1)); + &ipv6, "RLOC: %s", tvb_ip_to_str(pinfo->pool, tvb, ja_offset+ 1)); rloc_sub_tree = proto_item_add_subtree(rloc_tree, ett_pim); proto_tree_add_item(rloc_sub_tree, hf_pim_addr_af, tvb, ja_offset, 1, ENC_NA); proto_tree_add_item(rloc_sub_tree, hf_pim_rloc_addr_ipv6, tvb, ja_offset + 1, 16, ENC_NA); @@ -1262,7 +1262,7 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) hello_opt); for (i = offset + 4; i < offset + 4 + opt_len; ) { int advance; - if (!dissect_pim_addr(sub_tree, tvb, i, pimv2_unicast, NULL, NULL, + if (!dissect_pim_addr(pinfo, sub_tree, tvb, i, pimv2_unicast, NULL, NULL, hf_pim_address_list_ip4, hf_pim_address_list_ip6, &advance)) break; i += advance; @@ -1347,11 +1347,11 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { int advance; - if (!dissect_pim_addr(pimopt_tree, tvb, offset, pimv2_group, NULL, NULL, + if (!dissect_pim_addr(pinfo, pimopt_tree, tvb, offset, pimv2_group, NULL, NULL, hf_pim_group_ip4, hf_pim_group_ip6, &advance)) break; offset += advance; - if (!dissect_pim_addr(pimopt_tree, tvb, offset, pimv2_unicast, NULL, NULL, + if (!dissect_pim_addr(pinfo, pimopt_tree, tvb, offset, pimv2_unicast, NULL, NULL, hf_pim_source_ip4, hf_pim_source_ip6, &advance)) break; break; @@ -1369,7 +1369,7 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) proto_tree *subtree = NULL; proto_item *tisub; - if (!dissect_pim_addr(pimopt_tree, tvb, offset, pimv2_unicast, NULL, NULL, + if (!dissect_pim_addr(pinfo, pimopt_tree, tvb, offset, pimv2_unicast, NULL, NULL, hf_pim_upstream_neighbor_ip4, hf_pim_upstream_neighbor_ip6, &advance)) break; @@ -1389,7 +1389,7 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) for (i = 0; i < ngroup; i++) { tigroup=proto_tree_add_string_format(pimopt_tree, hf_pim_group, tvb, offset, -1, "", "Group %d", i); grouptree = proto_item_add_subtree(tigroup, ett_pim); - if (!dissect_pim_addr(grouptree, tvb, offset, pimv2_group, + if (!dissect_pim_addr(pinfo, grouptree, tvb, offset, pimv2_group, wmem_strdup_printf(pinfo->pool, "Group %d", i), NULL, hf_pim_group_ip4, hf_pim_group_ip6, &advance)) goto breakbreak3; @@ -1403,7 +1403,7 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) subtree = proto_item_add_subtree(tisub, ett_pim); off = offset + 4; for (j = 0; j < njoin; j++) { - if (!dissect_pim_addr(subtree, tvb, off, pimv2_source, NULL, NULL, + if (!dissect_pim_addr(pinfo, subtree, tvb, off, pimv2_source, NULL, NULL, hf_pim_join_ip4, hf_pim_join_ip6, &advance)) goto breakbreak3; @@ -1414,7 +1414,7 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) offset + 2, 2, ENC_BIG_ENDIAN); subtree = proto_item_add_subtree(tisub, ett_pim); for (j = 0; j < nprune; j++) { - if (!dissect_pim_addr(subtree, tvb, off, pimv2_source, NULL, NULL, + if (!dissect_pim_addr(pinfo, subtree, tvb, off, pimv2_source, NULL, NULL, hf_pim_prune_ip4, hf_pim_prune_ip6, &advance)) goto breakbreak3; @@ -1443,13 +1443,13 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) proto_tree_add_item(pimopt_tree, hf_pim_bsr_priority, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; - if (!dissect_pim_addr(pimopt_tree, tvb, offset, pimv2_unicast, NULL, NULL, + if (!dissect_pim_addr(pinfo, pimopt_tree, tvb, offset, pimv2_unicast, NULL, NULL, hf_pim_bsr_ip4, hf_pim_bsr_ip6, &advance)) break; offset += advance; for (i = 0; tvb_reported_length_remaining(tvb, offset) > 0; i++) { - if (!dissect_pim_addr(pimopt_tree, tvb, offset, pimv2_group, + if (!dissect_pim_addr(pinfo, pimopt_tree, tvb, offset, pimv2_group, wmem_strdup_printf(pinfo->pool, "Group %d", i), &tigroup, hf_pim_group_ip4, hf_pim_group_ip6, &advance)) goto breakbreak4; @@ -1464,7 +1464,7 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) offset += 3; for (j = 0; j < frpcnt; j++) { - if (!dissect_pim_addr(pimopt_tree, tvb, offset, pimv2_unicast, + if (!dissect_pim_addr(pinfo, pimopt_tree, tvb, offset, pimv2_unicast, wmem_strdup_printf(pinfo->pool, "RP %d", j), NULL, hf_pim_rp_ip4, hf_pim_rp_ip6, &advance)) @@ -1490,13 +1490,13 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { int advance; - if (!dissect_pim_addr(pimopt_tree, tvb, offset, pimv2_group, + if (!dissect_pim_addr(pinfo, pimopt_tree, tvb, offset, pimv2_group, NULL, NULL, hf_pim_group_ip4, hf_pim_group_ip6, &advance)) break; offset += advance; - if (!dissect_pim_addr(pimopt_tree, tvb, offset, pimv2_unicast, + if (!dissect_pim_addr(pinfo, pimopt_tree, tvb, offset, pimv2_unicast, NULL, NULL, hf_pim_source_ip4, hf_pim_source_ip6, &advance)) break; @@ -1527,14 +1527,14 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) proto_tree_add_item(pimopt_tree, hf_pim_holdtime, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; - if (!dissect_pim_addr(pimopt_tree, tvb, offset, pimv2_unicast, + if (!dissect_pim_addr(pinfo, pimopt_tree, tvb, offset, pimv2_unicast, NULL, NULL, hf_pim_rp_ip4, hf_pim_rp_ip6, &advance)) break; offset += advance; for (i = 0; i < pfxcnt; i++) { - if (!dissect_pim_addr(pimopt_tree, tvb, offset, pimv2_group, + if (!dissect_pim_addr(pinfo, pimopt_tree, tvb, offset, pimv2_group, wmem_strdup_printf(pinfo->pool, "Group %d", i), NULL, hf_pim_group_ip4, hf_pim_group_ip6, &advance)) goto breakbreak8; @@ -1548,19 +1548,19 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { int advance; - if (!dissect_pim_addr(pimopt_tree, tvb, offset, pimv2_group, + if (!dissect_pim_addr(pinfo, pimopt_tree, tvb, offset, pimv2_group, NULL, NULL, hf_pim_group_ip4, hf_pim_group_ip6, &advance)) break; offset += advance; - if (!dissect_pim_addr(pimopt_tree, tvb, offset, pimv2_unicast, + if (!dissect_pim_addr(pinfo, pimopt_tree, tvb, offset, pimv2_unicast, NULL, NULL, hf_pim_source_ip4, hf_pim_source_ip6, &advance)) break; offset += advance; - if (!dissect_pim_addr(pimopt_tree, tvb, offset, pimv2_unicast, + if (!dissect_pim_addr(pinfo, pimopt_tree, tvb, offset, pimv2_unicast, NULL, NULL, hf_pim_originator_ip4, hf_pim_originator_ip6, &advance)) break; @@ -1595,7 +1595,7 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { int advance; - if (!dissect_pim_addr(pimopt_tree, tvb, offset, pimv2_unicast, + if (!dissect_pim_addr(pinfo, pimopt_tree, tvb, offset, pimv2_unicast, NULL, NULL, hf_pim_rp_ip4, hf_pim_rp_ip6, &advance)) break; @@ -1608,7 +1608,7 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) switch(PIM_BIDIR_SUBTYPE(pim_bidir_subtype)) { case PIM_BDIR_DF_BACKOFF : - if (!dissect_pim_addr(pimopt_tree, tvb, offset, pimv2_unicast, + if (!dissect_pim_addr(pinfo, pimopt_tree, tvb, offset, pimv2_unicast, NULL, NULL, hf_pim_bd_bo_offer_ip4, hf_pim_bd_bo_offer_ip6, &advance)) break; @@ -1620,7 +1620,7 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) proto_tree_add_item(pimopt_tree, hf_pim_bd_offer_interval, tvb, offset, 2, ENC_BIG_ENDIAN); break; case PIM_BDIR_DF_PASS: - if (!dissect_pim_addr(pimopt_tree, tvb, offset, pimv2_unicast, + if (!dissect_pim_addr(pinfo, pimopt_tree, tvb, offset, pimv2_unicast, NULL, NULL, hf_pim_bd_pass_ip4, hf_pim_bd_pass_ip6, &advance)) break; @@ -1638,7 +1638,7 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) int opt_count = 0; int advance; - if (!dissect_pim_addr(pimopt_tree, tvb, offset, pimv2_unicast, NULL, NULL, + if (!dissect_pim_addr(pinfo, pimopt_tree, tvb, offset, pimv2_unicast, NULL, NULL, hf_pim_originator_ip4, hf_pim_originator_ip6, &advance)) break; offset += advance; @@ -1661,7 +1661,7 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) switch(pfm_opt){ case PIM_PFM_GROUP_SOURCE: { - if (!dissect_pim_addr(pimopt_tree, tvb, offset, pimv2_group, NULL, NULL, + if (!dissect_pim_addr(pinfo, pimopt_tree, tvb, offset, pimv2_group, NULL, NULL, hf_pim_group_ip4, hf_pim_group_ip6, &advance)) break; offset += advance; @@ -1672,7 +1672,7 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) proto_tree_add_item(pimopt_tree, hf_pim_srcholdt, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; while(src_count>0){ - if (!dissect_pim_addr(pimopt_tree, tvb, offset, pimv2_unicast, NULL, NULL, + if (!dissect_pim_addr(pinfo, pimopt_tree, tvb, offset, pimv2_unicast, NULL, NULL, hf_pim_source_ip4, hf_pim_source_ip6, &advance)) goto breakbreak12; offset+=advance; diff --git a/epan/dissectors/packet-shicp.c b/epan/dissectors/packet-shicp.c index 38a652ef14..752f11fc2c 100644 --- a/epan/dissectors/packet-shicp.c +++ b/epan/dissectors/packet-shicp.c @@ -180,8 +180,8 @@ dissect_shicp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 error_value = 0; guint64 flags_value = 0; - wmem_strbuf_t* supported_messages = wmem_strbuf_new(wmem_packet_scope(), ""); - wmem_strbuf_t* module_addr_strbuf = wmem_strbuf_new(wmem_packet_scope(), ""); + wmem_strbuf_t* supported_messages = wmem_strbuf_new(pinfo->pool, ""); + wmem_strbuf_t* module_addr_strbuf = wmem_strbuf_new(pinfo->pool, ""); static int* flags[] = { &hf_shicp_reserved_flag, @@ -198,16 +198,16 @@ dissect_shicp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, shicp_tree = proto_item_add_subtree(ti, ett_shicp); proto_item_append_text(ti, ", Src:%s, Dst:%s", - address_with_resolution_to_str(wmem_packet_scope(), &pinfo->dl_src), - address_with_resolution_to_str(wmem_packet_scope(), &pinfo->dl_dst)); + address_with_resolution_to_str(pinfo->pool, &pinfo->dl_src), + address_with_resolution_to_str(pinfo->pool, &pinfo->dl_dst)); proto_tree_add_item_ret_uint(shicp_tree, hf_shicp_header, tvb, offset, SHICP_HEADER_SIZE, ENC_LITTLE_ENDIAN, &version); proto_tree_add_uint(shicp_tree, hf_shicp_protocol_version, tvb, offset, SHICP_HEADER_SIZE, version & 0x07); offset += SHICP_HEADER_SIZE; proto_tree_add_item(shicp_tree, hf_shicp_dst, tvb, offset, SHICP_ADDRESS_SIZE, ENC_NA); - gchar* dst = tvb_address_to_str(wmem_packet_scope(), tvb, AT_ETHER, offset); + gchar* dst = tvb_address_to_str(pinfo->pool, tvb, AT_ETHER, offset); offset += SHICP_ADDRESS_SIZE; proto_tree_add_item(shicp_tree, hf_shicp_src, tvb, offset, SHICP_ADDRESS_SIZE, ENC_NA); - gchar* src = tvb_address_to_str(wmem_packet_scope(), tvb, AT_ETHER, offset); + gchar* src = tvb_address_to_str(pinfo->pool, tvb, AT_ETHER, offset); offset += SHICP_ADDRESS_SIZE; flags_pi = proto_tree_add_bitmask_ret_uint64(shicp_tree, tvb, offset, hf_shicp_flags, ett_shicp_flags, flags, ENC_LITTLE_ENDIAN, &flags_value); offset += SHICP_FLAGS_SIZE; diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c index 7c376556ad..d6091b18dc 100644 --- a/epan/dissectors/packet-tcp.c +++ b/epan/dissectors/packet-tcp.c @@ -5591,7 +5591,7 @@ dissect_tcpopt_timestamp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, vo proto_item* syncookie_ti = proto_item_add_subtree(ti, ett_tcp_syncookie_option); guint32 timestamp = tvb_get_bits32(tvb, offset * 8, 26, ENC_NA) << 6; proto_tree_add_uint_bits_format_value(syncookie_ti, hf_tcp_syncookie_option_timestamp, tvb, offset * 8, - 26, timestamp, ENC_TIME_SECS, "%s", abs_time_secs_to_str(wmem_packet_scope(), timestamp, ABSOLUTE_TIME_LOCAL, TRUE)); + 26, timestamp, ENC_TIME_SECS, "%s", abs_time_secs_to_str(pinfo->pool, timestamp, ABSOLUTE_TIME_LOCAL, TRUE)); proto_tree_add_bits_item(syncookie_ti, hf_tcp_syncookie_option_ecn, tvb, offset * 8 + 26, 1, ENC_NA); proto_tree_add_bits_item(syncookie_ti, hf_tcp_syncookie_option_sack, tvb, offset * 8 + 27, 1, ENC_NA); proto_tree_add_bits_item(syncookie_ti, hf_tcp_syncookie_option_wscale, tvb, offset * 8 + 28, 4, ENC_NA); diff --git a/epan/dissectors/packet-yami.c b/epan/dissectors/packet-yami.c index 8bf44edab6..8bc00db041 100644 --- a/epan/dissectors/packet-yami.c +++ b/epan/dissectors/packet-yami.c @@ -83,7 +83,7 @@ static int ett_yami_msg_data = -1; static int ett_yami_param = -1; static int -dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item *par_ti) +dissect_yami_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_item *par_ti) { const int orig_offset = offset; @@ -103,7 +103,7 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item * name_len = tvb_get_letohl(tvb, offset); offset += 4; - name = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, name_len, ENC_ASCII | ENC_NA); + name = tvb_get_string_enc(pinfo->pool, tvb, offset, name_len, ENC_ASCII | ENC_NA); proto_item_append_text(ti, ": %s", name); proto_item_append_text(par_ti, "%s, ", name); offset += WS_ROUNDUP_4(name_len); @@ -159,7 +159,7 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item * val_len = tvb_get_letohl(tvb, offset); offset += 4; - val = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, val_len, ENC_ASCII | ENC_NA); + val = tvb_get_string_enc(pinfo->pool, tvb, offset, val_len, ENC_ASCII | ENC_NA); proto_item_append_text(ti, ", Type: string, Value: \"%s\"", val); offset += WS_ROUNDUP_4(val_len); @@ -178,7 +178,7 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item * offset += 4; val = tvb_get_ptr(tvb, offset, val_len); - repr = bytes_to_str(wmem_packet_scope(), val, val_len); + repr = bytes_to_str(pinfo->pool, val, val_len); proto_item_append_text(ti, ", Type: binary, Value: %s", repr); offset += WS_ROUNDUP_4(val_len); @@ -311,7 +311,7 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item * val_len = tvb_get_letohl(tvb, offset); offset += 4; - val = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, val_len, ENC_ASCII | ENC_NA); + val = tvb_get_string_enc(pinfo->pool, tvb, offset, val_len, ENC_ASCII | ENC_NA); proto_item_append_text(ti, "\"%s\", ", val); proto_tree_add_string(yami_param, hf_yami_param_value_str, tvb, val_offset, offset - val_offset, val); @@ -342,7 +342,7 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item * offset += 4; val = tvb_get_ptr(tvb, offset, val_len); - repr = bytes_to_str(wmem_packet_scope(), val, val_len); + repr = bytes_to_str(pinfo->pool, val, val_len); proto_item_append_text(ti, "%s, ", repr); offset += WS_ROUNDUP_4(val_len); @@ -364,7 +364,7 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item * proto_item_append_text(ti, ", Type: nested, %u parameters: ", count); for (i = 0; i < count; i++) { - offset = dissect_yami_parameter(tvb, yami_param, offset, ti); + offset = dissect_yami_parameter(tvb, pinfo, yami_param, offset, ti); /* smth went wrong */ if (offset == -1) return -1; @@ -382,7 +382,7 @@ dissect_yami_parameter(tvbuff_t *tvb, proto_tree *tree, int offset, proto_item * } static int -dissect_yami_data(tvbuff_t *tvb, gboolean data, proto_tree *tree, int offset) +dissect_yami_data(tvbuff_t *tvb, packet_info *pinfo, gboolean data, proto_tree *tree, int offset) { const int orig_offset = offset; @@ -402,7 +402,7 @@ dissect_yami_data(tvbuff_t *tvb, gboolean data, proto_tree *tree, int offset) proto_item_append_text(ti, ", %u parameters: ", count); for (i = 0; i < count; i++) { - offset = dissect_yami_parameter(tvb, yami_data_tree, offset, ti); + offset = dissect_yami_parameter(tvb, pinfo, yami_data_tree, offset, ti); /* smth went wrong */ if (offset == -1) return -1; @@ -459,13 +459,13 @@ dissect_yami_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data if (message_header_size <= frame_payload_size) { const int orig_offset = offset; - offset = dissect_yami_data(tvb, FALSE, yami_tree, offset); + offset = dissect_yami_data(tvb, pinfo, FALSE, yami_tree, offset); if (offset != orig_offset + message_header_size) { /* XXX, expert info */ offset = orig_offset + message_header_size; } - dissect_yami_data(tvb, TRUE, yami_tree, offset); + dissect_yami_data(tvb, pinfo, TRUE, yami_tree, offset); } } diff --git a/plugins/epan/ethercat/packet-ecatmb.c b/plugins/epan/ethercat/packet-ecatmb.c index 2a7aaab86c..c5998540e5 100644 --- a/plugins/epan/ethercat/packet-ecatmb.c +++ b/plugins/epan/ethercat/packet-ecatmb.c @@ -358,7 +358,7 @@ static void CANopenSdoReqFormatter(PETHERCAT_SDO_HEADER pSdo, char *szText, gint } } -static void FoeFormatter(tvbuff_t *tvb, gint offset, char *szText, gint nMax, guint foe_length) +static void FoeFormatter(tvbuff_t *tvb, wmem_allocator_t *scope, gint offset, char *szText, gint nMax, guint foe_length) { ETHERCAT_FOE_HEADER foe; char *tmp = NULL; @@ -371,7 +371,7 @@ static void FoeFormatter(tvbuff_t *tvb, gint offset, char *szText, gint nMax, gu case ECAT_FOE_OPMODE_WRQ: case ECAT_FOE_OPMODE_ERR: if ( foe_length > ETHERCAT_FOE_HEADER_LEN ) { - tmp = tvb_get_string_enc(wmem_packet_scope(), tvb, offset+ETHERCAT_FOE_HEADER_LEN, MIN(foe_length-ETHERCAT_FOE_HEADER_LEN, 49), ENC_ASCII); + tmp = tvb_get_string_enc(scope, tvb, offset+ETHERCAT_FOE_HEADER_LEN, MIN(foe_length-ETHERCAT_FOE_HEADER_LEN, 49), ENC_ASCII); } break; } @@ -1098,7 +1098,7 @@ static void dissect_ecat_foe(tvbuff_t *tvb, gint offset, packet_info *pinfo, pro if( foe_length >= ETHERCAT_FOE_HEADER_LEN ) { - FoeFormatter(tvb, offset, szText, nMax, foe_length); + FoeFormatter(tvb, pinfo->pool, offset, szText, nMax, foe_length); col_append_str(pinfo->cinfo, COL_INFO, szText); if( tree ) diff --git a/plugins/epan/profinet/packet-pn-dcp.c b/plugins/epan/profinet/packet-pn-dcp.c index b9ab22ba85..01c2829347 100644 --- a/plugins/epan/profinet/packet-pn-dcp.c +++ b/plugins/epan/profinet/packet-pn-dcp.c @@ -1051,7 +1051,7 @@ dissect_PNDCP_Suboption_TSN(tvbuff_t* tvb, int offset, packet_info* pinfo, case PNDCP_SUBOPTION_TSN_DOMAIN_NAME: offset = dissect_pn_uuid(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_tsn_domain_uuid, &tsn_domain_uuid); - proto_tree_add_item_ret_display_string(tree, hf_pn_dcp_suboption_tsn_domain_name, tvb, offset, (block_length-16), ENC_ASCII | ENC_NA, wmem_packet_scope(), &domain_name); + proto_tree_add_item_ret_display_string(tree, hf_pn_dcp_suboption_tsn_domain_name, tvb, offset, (block_length-16), ENC_ASCII | ENC_NA, pinfo->pool, &domain_name); pn_append_info(pinfo, dcp_item, ", TSN-Domain Name"); proto_item_append_text(block_item, "TSN/TSN-Domain Name"); @@ -1062,7 +1062,7 @@ dissect_PNDCP_Suboption_TSN(tvbuff_t* tvb, int offset, packet_info* pinfo, if (have_block_info) proto_item_append_text(block_item, ", BlockInfo: %s", rval_to_str(block_info, pn_dcp_block_info, "Unknown")); - pn_append_info(pinfo, dcp_item, wmem_strdup_printf(wmem_packet_scope(), ", DomainName:\"%s\"", domain_name)); + pn_append_info(pinfo, dcp_item, wmem_strdup_printf(pinfo->pool, ", DomainName:\"%s\"", domain_name)); proto_item_append_text(block_item, ", \"%s\"", domain_name); offset += (block_length-16); is_zeros = TRUE;