aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-mndp.c
diff options
context:
space:
mode:
authorDavid Perry <boolean263@protonmail.com>2021-07-28 15:50:57 -0400
committerWireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2021-07-29 01:36:01 +0000
commit34ee3cbc489444bf07818826519e176dc63f3307 (patch)
treec03cc5ba2f31eb62c671ea6372eafc82501d35f4 /epan/dissectors/packet-mndp.c
parent0983eb2456b8c6dbc7a2b5d4471d70e71fafc8b5 (diff)
Change some `wmem_packet_scope()` to `pinfo->pool`
As requested [here][1], help with replacing calls to `wmem_packet_scope()` with references to `pinfo->pool`. My principles were: * Plugins chosen semi-randomly. * When a calling function already has a `pinfo` argument, just use that. * Remove `_U_` from its signature if it was there. * Don't go more than 2 or 3 levels deep of changing signatures. * If a function is clearly allocing memory to return, change the function signature to take a `wmem_allocator_t *`. Otherwise, either that or take a `packet_info *` as seems to make sense. * No mention of `wmem_packet_scope()` should remain in the files I've touched. * I didn't always succeed at this, but I made a dent. [1]: https://www.wireshark.org/lists/wireshark-dev/202107/msg00052.html
Diffstat (limited to 'epan/dissectors/packet-mndp.c')
-rw-r--r--epan/dissectors/packet-mndp.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/epan/dissectors/packet-mndp.c b/epan/dissectors/packet-mndp.c
index 66588ad7dc..a6cbfdd0a1 100644
--- a/epan/dissectors/packet-mndp.c
+++ b/epan/dissectors/packet-mndp.c
@@ -89,7 +89,7 @@ match_strextval_idx(guint32 val, const ext_value_string *vs, gint *idx) {
}
static const gchar*
-extval_to_str_idx(guint32 val, const ext_value_string *vs, gint *idx, const char *fmt) {
+extval_to_str_idx(wmem_allocator_t *pool, guint32 val, const ext_value_string *vs, gint *idx, const char *fmt) {
const gchar *ret;
if (!fmt)
@@ -99,7 +99,7 @@ extval_to_str_idx(guint32 val, const ext_value_string *vs, gint *idx, const char
if (ret != NULL)
return ret;
- return wmem_strdup_printf(wmem_packet_scope(), fmt, val);
+ return wmem_strdup_printf(pool, fmt, val);
}
/* ============= end copy/paste/modify ============== */
@@ -149,12 +149,12 @@ dissect_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *mndp_tree,
"T %d, L %d: %s",
tlv_type,
tlv_length,
- extval_to_str_idx(tlv_type, value_array, NULL, "Unknown"));
+ extval_to_str_idx(pinfo->pool, tlv_type, value_array, NULL, "Unknown"));
type_item = proto_tree_add_item(tlv_tree, hf_mndp_tlv_type,
tvb, offset, 2, ENC_BIG_ENDIAN);
proto_item_append_text(type_item, " = %s",
- extval_to_str_idx(tlv_type, value_array,
+ extval_to_str_idx(pinfo->pool, tlv_type, value_array,
&type_index, "Unknown"));
offset += 2;
proto_tree_add_item(tlv_tree, hf_mndp_tlv_length,