convert variables that were static just because of SET_ADDRESS macro to use the proper pinfo->pool instead.

Change-Id: I914918d9629f654ead497dddac0f412b690e4409
Reviewed-on: https://code.wireshark.org/review/6430
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Michael Mann 2015-01-08 17:07:25 -05:00
parent a2abf8b37f
commit ecaa1f8d21
8 changed files with 40 additions and 49 deletions

View File

@ -1437,7 +1437,8 @@ dissect_ddp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
e_ddp ddp;
proto_tree *ddp_tree;
proto_item *ti, *hidden_item;
static struct atalk_ddp_addr src, dst; /* has to be static due to SET_ADDRESS */
struct atalk_ddp_addr *src = wmem_new(pinfo->pool, struct atalk_ddp_addr),
*dst = wmem_new(pinfo->pool, struct atalk_ddp_addr);
tvbuff_t *new_tvb;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "DDP");
@ -1449,14 +1450,14 @@ dissect_ddp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
ddp.sum=g_ntohs(ddp.sum);
ddp.hops_len=g_ntohs(ddp.hops_len);
src.net = ddp.snet;
src.node = ddp.snode;
dst.net = ddp.dnet;
dst.node = ddp.dnode;
SET_ADDRESS(&pinfo->net_src, AT_ATALK, sizeof src, (guint8 *)&src);
SET_ADDRESS(&pinfo->src, AT_ATALK, sizeof src, (guint8 *)&src);
SET_ADDRESS(&pinfo->net_dst, AT_ATALK, sizeof dst, (guint8 *)&dst);
SET_ADDRESS(&pinfo->dst, AT_ATALK, sizeof dst, (guint8 *)&dst);
src->net = ddp.snet;
src->node = ddp.snode;
dst->net = ddp.dnet;
dst->node = ddp.dnode;
SET_ADDRESS(&pinfo->net_src, AT_ATALK, sizeof src, src);
SET_ADDRESS(&pinfo->src, AT_ATALK, sizeof src, src);
SET_ADDRESS(&pinfo->net_dst, AT_ATALK, sizeof dst, dst);
SET_ADDRESS(&pinfo->dst, AT_ATALK, sizeof dst, dst);
pinfo->ptype = PT_DDP;
pinfo->destport = ddp.dport;
@ -1471,11 +1472,11 @@ dissect_ddp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
ddp_tree = proto_item_add_subtree(ti, ett_ddp);
hidden_item = proto_tree_add_string(ddp_tree, hf_ddp_src, tvb,
4, 3, atalk_addr_to_str(&src));
4, 3, atalk_addr_to_str(src));
PROTO_ITEM_SET_HIDDEN(hidden_item);
hidden_item = proto_tree_add_string(ddp_tree, hf_ddp_dst, tvb,
6, 3, atalk_addr_to_str(&dst));
6, 3, atalk_addr_to_str(dst));
PROTO_ITEM_SET_HIDDEN(hidden_item);
proto_tree_add_uint(ddp_tree, hf_ddp_hopcount, tvb, 0, 1,

View File

@ -315,7 +315,7 @@ dissect_fddi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_item *ti, *hidden_item;
const gchar *fc_str;
proto_tree *fc_tree;
static guchar src[6], dst[6]; /* has to be static due to SET_ADDRESS */
guchar *src = (guchar*)wmem_alloc(pinfo->pool, 6), *dst = (guchar*)wmem_alloc(pinfo->pool, 6);
guchar src_swapped[6], dst_swapped[6];
tvbuff_t *next_tvb;
static fddi_hdr fddihdrs[4];
@ -370,9 +370,9 @@ dissect_fddi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* XXX - copy them to some buffer associated with "pi", rather than
just making "dst" static? */
SET_ADDRESS(&pinfo->dl_dst, AT_ETHER, 6, &dst[0]);
SET_ADDRESS(&pinfo->dst, AT_ETHER, 6, &dst[0]);
SET_ADDRESS(&fddihdr->dst, AT_ETHER, 6, &dst[0]);
SET_ADDRESS(&pinfo->dl_dst, AT_ETHER, 6, dst);
SET_ADDRESS(&pinfo->dst, AT_ETHER, 6, dst);
SET_ADDRESS(&fddihdr->dst, AT_ETHER, 6, dst);
if (fh_tree) {
proto_tree_add_ether(fh_tree, hf_fddi_dst, tvb, FDDI_P_DHOST + FDDI_PADDING, 6, dst);
@ -395,9 +395,9 @@ dissect_fddi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* XXX - copy them to some buffer associated with "pi", rather than
just making "src" static? */
SET_ADDRESS(&pinfo->dl_src, AT_ETHER, 6, &src[0]);
SET_ADDRESS(&pinfo->src, AT_ETHER, 6, &src[0]);
SET_ADDRESS(&fddihdr->src, AT_ETHER, 6, &src[0]);
SET_ADDRESS(&pinfo->dl_src, AT_ETHER, 6, src);
SET_ADDRESS(&pinfo->src, AT_ETHER, 6, src);
SET_ADDRESS(&fddihdr->src, AT_ETHER, 6, src);
if (fh_tree) {
proto_tree_add_ether(fh_tree, hf_fddi_src, tvb, FDDI_P_SHOST + FDDI_PADDING, 6, src);

View File

@ -728,21 +728,16 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g
offset += 2;
}
else if (packet->dst_addr_mode == IEEE802154_FCF_ADDR_EXT) {
static guint64 addr; /* has to be static due to SET_ADDRESS */
/* Get the address */
packet->dst64 = tvb_get_letoh64(tvb, offset);
/* Copy and convert the address to network byte order. */
addr = pntoh64(&(packet->dst64));
/* Display the destination address. */
/* XXX - OUI resolution doesn't happen when displaying resolved
* EUI64 addresses; that should probably be fixed in
* epan/addr_resolv.c.
*/
SET_ADDRESS(&pinfo->dl_dst, AT_EUI64, 8, &addr);
SET_ADDRESS(&pinfo->dst, AT_EUI64, 8, &addr);
TVB_SET_ADDRESS(&pinfo->dl_dst, AT_EUI64, tvb, offset, 8);
TVB_SET_ADDRESS(&pinfo->dst, AT_EUI64, tvb, offset, 8);
if (tree) {
proto_tree_add_item(ieee802154_tree, hf_ieee802154_dst64, tvb, offset, 8, ENC_LITTLE_ENDIAN);
proto_item_append_text(proto_root, ", Dst: %s", ep_eui64_to_display(packet->dst64));
@ -841,21 +836,16 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g
offset += 2;
}
else if (packet->src_addr_mode == IEEE802154_FCF_ADDR_EXT) {
static guint64 addr; /* has to be static due to SET_ADDRESS */
/* Get the address. */
packet->src64 = tvb_get_letoh64(tvb, offset);
/* Copy and convert the address to network byte order. */
addr = pntoh64(&(packet->src64));
/* Display the source address. */
/* XXX - OUI resolution doesn't happen when displaying resolved
* EUI64 addresses; that should probably be fixed in
* epan/addr_resolv.c.
*/
SET_ADDRESS(&pinfo->dl_src, AT_EUI64, 8, &addr);
SET_ADDRESS(&pinfo->src, AT_EUI64, 8, &addr);
TVB_SET_ADDRESS(&pinfo->dl_src, AT_EUI64, tvb, offset, 8);
TVB_SET_ADDRESS(&pinfo->src, AT_EUI64, tvb, offset, 8);
if (tree) {
proto_tree_add_item(ieee802154_tree, hf_ieee802154_src64, tvb, offset, 8, ENC_LITTLE_ENDIAN);
proto_item_append_text(proto_root, ", Src: %s", ep_eui64_to_display(packet->src64));

View File

@ -1117,7 +1117,6 @@ static conversation_t
gboolean is_data, gboolean req)
{
conversation_t *conversation = NULL;
static usb_address_t src_addr, dst_addr; /* has to be static due to SET_ADDRESS */
guint16 device_address;
guint16 bus_num;
int endpoint;
@ -1128,8 +1127,7 @@ static conversation_t
endpoint = mausb_ep_handle_ep_num(handle);
bus_num = mausb_ep_handle_bus_num(handle);
usb_set_addr(pinfo, &src_addr, &dst_addr, bus_num, device_address,
endpoint, req);
usb_set_addr(pinfo, bus_num, device_address, endpoint, req);
conversation = get_usb_conversation(pinfo, &pinfo->src, &pinfo->dst,
pinfo->srcport, pinfo->destport);
}

View File

@ -1843,7 +1843,7 @@ dissect_fid4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
NULL
};
static struct sna_fid_type_4_addr src, dst; /* has to be static due to SET_ADDRESS */
struct sna_fid_type_4_addr *src, *dst;
const int bytes_in_header = 26;
@ -1915,8 +1915,9 @@ dissect_fid4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_uint(tree, hf_sna_th_def, tvb, offset, 2, def);
/* Addresses in FID 4 are discontiguous, sigh */
dst.saf = dsaf;
dst.ef = def;
dst = wmem_new(pinfo->pool, struct sna_fid_type_4_addr);
dst->saf = dsaf;
dst->ef = def;
SET_ADDRESS(&pinfo->net_dst, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN,
(guint8* )&dst);
SET_ADDRESS(&pinfo->dst, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN,
@ -1926,8 +1927,9 @@ dissect_fid4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_uint(tree, hf_sna_th_oef, tvb, offset+2, 2, oef);
/* Addresses in FID 4 are discontiguous, sigh */
src.saf = osaf;
src.ef = oef;
src = wmem_new(pinfo->pool, struct sna_fid_type_4_addr);
src->saf = osaf;
src->ef = oef;
SET_ADDRESS(&pinfo->net_src, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN,
(guint8 *)&src);
SET_ADDRESS(&pinfo->src, AT_SNA, SNA_FID_TYPE_4_ADDR_LEN,

View File

@ -398,7 +398,7 @@ dissect_tr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tr_hdr *volatile trh;
/* non-source-routed version of source addr */
static guint8 trn_shost_nonsr[6]; /* has to be static due to SET_ADDRESS */
guint8 *trn_shost_nonsr = (guint8*)wmem_alloc(pinfo->pool, 6);
int x;
/* Token-Ring Strings */

View File

@ -2740,9 +2740,9 @@ try_dissect_next_protocol(proto_tree *tree, tvbuff_t *next_tvb, packet_info *pin
usb_conv_info->usb_trans_info = usb_trans_info;
}
else if (ctrl_recip == RQT_SETUP_RECIPIENT_ENDPOINT) {
static address endpoint_addr;
address endpoint_addr;
gint endpoint;
static usb_address_t src_addr, dst_addr; /* has to be static due to SET_ADDRESS */
usb_address_t src_addr, dst_addr;
guint32 src_endpoint, dst_endpoint;
conversation_t *conversation;
@ -3106,10 +3106,12 @@ dissect_usbpcap_buffer_packet_header(tvbuff_t *tvb, packet_info *pinfo, proto_tr
/* Set the usb_address_t fields based on the direction of the urb */
void
usb_set_addr(packet_info *pinfo, usb_address_t *src_addr,
usb_address_t *dst_addr, guint16 bus_id, guint16 device_address,
usb_set_addr(packet_info *pinfo, guint16 bus_id, guint16 device_address,
int endpoint, gboolean req)
{
usb_address_t *src_addr = wmem_new(pinfo->pool, usb_address_t),
*dst_addr = wmem_new(pinfo->pool, usb_address_t);
if (req) {
/* request */
src_addr->device = 0xffffffff;
@ -3404,7 +3406,6 @@ dissect_usb_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent,
proto_item *urb_tree_ti;
proto_tree *tree;
proto_item *item;
static usb_address_t src_addr, dst_addr; /* has to be static due to SET_ADDRESS */
usb_conv_info_t *usb_conv_info;
conversation_t *conversation;
guint16 device_address;
@ -3438,7 +3439,7 @@ dissect_usb_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent,
else
return; /* invalid USB pseudo header */
usb_set_addr(pinfo, &src_addr, &dst_addr, bus_id, device_address, endpoint,
usb_set_addr(pinfo, bus_id, device_address, endpoint,
(urb_type == URB_SUBMIT));
conversation = get_usb_conversation(pinfo, &pinfo->src, &pinfo->dst, pinfo->srcport, pinfo->destport);

View File

@ -239,8 +239,7 @@ dissect_usb_setup_request(packet_info *pinfo, proto_tree *tree,
void
usb_set_addr(packet_info *pinfo, usb_address_t *src_addr,
usb_address_t *dst_addr, guint16 bus_id, guint16 device_address,
usb_set_addr(packet_info *pinfo, guint16 bus_id, guint16 device_address,
int endpoint, gboolean req);
usb_trans_info_t