diff options
author | Evan Huus <eapache@gmail.com> | 2021-09-15 12:09:18 -0400 |
---|---|---|
committer | Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org> | 2021-09-16 07:12:20 +0000 |
commit | e4b8a5851384f3cac5bb8cefa9d7f668f907d15d (patch) | |
tree | 49e5677de61f4c15f4123847f5b13f9a132192db /epan/dissectors/packet-ppi.c | |
parent | f4aa108913db786e8dc4c2333849c8c07afebb2c (diff) |
ptvcursor: add explicit memory scope
I was hoping to avoid this, since the ptvcursor should already be
implicitly scoped to the tree it is working on. But there are a bunch of
call sites where the passed tree can be NULL (?) and a few places where
the tree is explicitly set/reset after creation, so requiring an
explicit scope is safer.
Avoids global memory pools in favour of ones the compiler can verify.
Diffstat (limited to 'epan/dissectors/packet-ppi.c')
-rw-r--r-- | epan/dissectors/packet-ppi.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/epan/dissectors/packet-ppi.c b/epan/dissectors/packet-ppi.c index 47085a6ad4..27b46fbb8a 100644 --- a/epan/dissectors/packet-ppi.c +++ b/epan/dissectors/packet-ppi.c @@ -407,7 +407,7 @@ add_ppi_field_header(tvbuff_t *tvb, proto_tree *tree, int *offset) { ptvcursor_t *csr; - csr = ptvcursor_new(tree, tvb, *offset); + csr = ptvcursor_new(wmem_packet_scope(), tree, tvb, *offset); ptvcursor_add(csr, hf_ppi_field_type, 2, ENC_LITTLE_ENDIAN); ptvcursor_add(csr, hf_ppi_field_len, 2, ENC_LITTLE_ENDIAN); ptvcursor_free(csr); @@ -445,7 +445,7 @@ dissect_80211_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of else phdr->fcs_len = 0; - csr = ptvcursor_new(ftree, tvb, offset); + csr = ptvcursor_new(pinfo->pool, ftree, tvb, offset); tsft_raw = tvb_get_letoh64(tvb, offset); if (tsft_raw != 0) { @@ -620,7 +620,7 @@ dissect_80211n_mac(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int return; } - csr = ptvcursor_new(ftree, tvb, offset); + csr = ptvcursor_new(pinfo->pool, ftree, tvb, offset); flags = tvb_get_letohl(tvb, ptvcursor_current_offset(csr)); *n_mac_flags = flags; @@ -687,7 +687,7 @@ dissect_80211n_mac_phy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int FALSE, n_mac_flags, ampdu_id, phdr); offset += PPI_80211N_MAC_PHY_OFF; - csr = ptvcursor_new(ftree, tvb, offset); + csr = ptvcursor_new(pinfo->pool, ftree, tvb, offset); mcs = tvb_get_guint8(tvb, ptvcursor_current_offset(csr)); if (mcs != 255) { @@ -762,7 +762,7 @@ dissect_aggregation_extension(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree return; } - csr = ptvcursor_new(ftree, tvb, offset); + csr = ptvcursor_new(pinfo->pool, ftree, tvb, offset); ptvcursor_add(csr, hf_aggregation_extension_interface_id, 4, ENC_LITTLE_ENDIAN); /* Last */ ptvcursor_free(csr); @@ -783,7 +783,7 @@ dissect_8023_extension(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, return; } - csr = ptvcursor_new(ftree, tvb, offset); + csr = ptvcursor_new(pinfo->pool, ftree, tvb, offset); ptvcursor_add_with_subtree(csr, hf_8023_extension_flags, 4, ENC_LITTLE_ENDIAN, ett_8023_extension_flags); ptvcursor_add(csr, hf_8023_extension_flags_fcs_present, 4, ENC_LITTLE_ENDIAN); |