diff options
author | Michael Mann <mmann78@netscape.net> | 2016-06-26 10:52:37 -0400 |
---|---|---|
committer | Pascal Quantin <pascal.quantin@gmail.com> | 2016-06-27 15:20:06 +0000 |
commit | 2ab415579491e4bc66ea58627bda504cae833b9e (patch) | |
tree | 0f7f8eaa4bd9d90c8f6066036522ef0fc65d137d /epan/dissectors/packet-dhcp-failover.c | |
parent | 8c37621ca733a24a972e3e069a537c06e650f435 (diff) |
tvb_get_string_enc + proto_tree_add_item = proto_tree_add_item_ret_string
Also some other tricks to remove unnecessary tvb_get_string_enc calls.
Change-Id: I2f40d9175b6c0bb0b1364b4089bfaa287edf0914
Reviewed-on: https://code.wireshark.org/review/16158
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-dhcp-failover.c')
-rw-r--r-- | epan/dissectors/packet-dhcp-failover.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/epan/dissectors/packet-dhcp-failover.c b/epan/dissectors/packet-dhcp-failover.c index aacffcfee4..1146df9c59 100644 --- a/epan/dissectors/packet-dhcp-failover.c +++ b/epan/dissectors/packet-dhcp-failover.c @@ -376,7 +376,7 @@ dissect_dhcpfo_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da gboolean bogus_poffset; guint16 opcode, option_length; guint8 htype, reject_reason, message_digest_type, binding_status; - guint8 *vendor_class_str; + const guint8 *vendor_class_str; const gchar *htype_str; gchar *lease_expiration_time_str, *grace_expiration_time_str, *potential_expiration_time_str, *client_last_transaction_time_str, *start_time_of_state_str; @@ -563,15 +563,18 @@ dissect_dhcpfo_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da break; case DHCP_FO_PD_CLIENT_IDENTIFIER: + { + const guint8* identifier; /* * XXX - if this is truly like DHCP option 81, * we need to dissect it as such. */ - proto_item_append_text(oi,", \"%s\"", tvb_get_string_enc(wmem_packet_scope(), tvb, offset, option_length, ENC_ASCII)); - - proto_tree_add_item(option_tree, + proto_tree_add_item_ret_string(option_tree, hf_dhcpfo_client_identifier, tvb, offset, - option_length, ENC_ASCII|ENC_NA); + option_length, ENC_ASCII|ENC_NA, wmem_packet_scope(), &identifier); + + proto_item_append_text(oi,", \"%s\"", identifier); + } break; case DHCP_FO_PD_CLIENT_HARDWARE_ADDRESS: @@ -631,13 +634,11 @@ dissect_dhcpfo_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da break; case DHCP_FO_PD_VENDOR_CLASS: - vendor_class_str = - tvb_get_string_enc(wmem_packet_scope(), tvb, offset, option_length, ENC_ASCII); + proto_tree_add_item_ret_string(option_tree, + hf_dhcpfo_vendor_class, tvb, offset, + option_length, ENC_ASCII, wmem_packet_scope(), &vendor_class_str); proto_item_append_text(oi,", \"%s\"", format_text(vendor_class_str, option_length)); - proto_tree_add_string(option_tree, - hf_dhcpfo_vendor_class, tvb, offset, - option_length, vendor_class_str); break; case DHCP_FO_PD_LEASE_EXPIRATION_TIME: |