From a062c802364fd83d43f934560149f2ddd1fee6a3 Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Thu, 30 Jun 2016 20:41:45 -0400 Subject: ASN.1 dissectors - don't try to find yourself. If an ASN.1 dissector is calling register_dissector for itself in its proto_register_xxx function and then calling find_dissector for itself in its proto_reg_handoff_xxx function then just create a static handle for that dissector and use the return value of register_dissector, so the find isn't necessary. Change-Id: I911bdadc2fb4259601c141b955e741a2369cc447 Reviewed-on: https://code.wireshark.org/review/16233 Reviewed-by: Michael Mann Petri-Dish: Michael Mann Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- epan/dissectors/asn1/snmp/packet-snmp-template.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'epan/dissectors/asn1/snmp') diff --git a/epan/dissectors/asn1/snmp/packet-snmp-template.c b/epan/dissectors/asn1/snmp/packet-snmp-template.c index dcd7c50bf0..27008e9a52 100644 --- a/epan/dissectors/asn1/snmp/packet-snmp-template.c +++ b/epan/dissectors/asn1/snmp/packet-snmp-template.c @@ -2524,7 +2524,7 @@ void proto_register_snmp(void) { /* Register protocol */ proto_snmp = proto_register_protocol(PNAME, PSNAME, PFNAME); - register_dissector("snmp", dissect_snmp, proto_snmp); + snmp_handle = register_dissector("snmp", dissect_snmp, proto_snmp); /* Register fields and subtrees */ proto_register_field_array(proto_snmp, hf, array_length(hf)); @@ -2583,8 +2583,6 @@ void proto_register_snmp(void) { void proto_reg_handoff_snmp(void) { dissector_handle_t snmp_tcp_handle; - snmp_handle = find_dissector("snmp"); - dissector_add_uint("udp.port", UDP_PORT_SNMP, snmp_handle); dissector_add_uint("udp.port", UDP_PORT_SNMP_TRAP, snmp_handle); dissector_add_uint("udp.port", UDP_PORT_SNMP_PATROL, snmp_handle); -- cgit v1.2.3