diff options
author | David Perry <boolean263@protonmail.com> | 2021-07-28 15:50:57 -0400 |
---|---|---|
committer | Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org> | 2021-07-29 01:36:01 +0000 |
commit | 34ee3cbc489444bf07818826519e176dc63f3307 (patch) | |
tree | c03cc5ba2f31eb62c671ea6372eafc82501d35f4 /epan/dissectors/packet-hclnfsd.c | |
parent | 0983eb2456b8c6dbc7a2b5d4471d70e71fafc8b5 (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-hclnfsd.c')
-rw-r--r-- | epan/dissectors/packet-hclnfsd.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/epan/dissectors/packet-hclnfsd.c b/epan/dissectors/packet-hclnfsd.c index 684758d11b..088ba85e2f 100644 --- a/epan/dissectors/packet-hclnfsd.c +++ b/epan/dissectors/packet-hclnfsd.c @@ -160,12 +160,12 @@ static const value_string names_request_type[] = { }; static char * -hclnfsd_decode_obscure(const char *ident, int ident_len) +hclnfsd_decode_obscure(wmem_allocator_t *pool, const char *ident, int ident_len) { char *ident_decoded, *ident_out; int j, x, y; - ident_decoded = (char *)wmem_alloc(wmem_packet_scope(), ident_len); + ident_decoded = (char *)wmem_alloc(pool, ident_len); ident_out = ident_decoded; for (x = -1, j = 0; j < ident_len; j++) { @@ -181,7 +181,7 @@ hclnfsd_decode_obscure(const char *ident, int ident_len) static int -dissect_hclnfsd_authorize_call(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) +dissect_hclnfsd_authorize_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { guint32 request_type; const char *ident = NULL; @@ -219,7 +219,7 @@ dissect_hclnfsd_authorize_call(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree proto_item_set_len(ident_item, ident_len); - ident_decoded = hclnfsd_decode_obscure(ident, ident_len); + ident_decoded = hclnfsd_decode_obscure(pinfo->pool, ident, ident_len); username = ident_decoded + 2; password = username + strlen(username) + 1; |