From f53596396116d9cfb0f062c7c7704b36674483f0 Mon Sep 17 00:00:00 2001 From: etxrab Date: Fri, 9 Oct 2009 07:24:33 +0000 Subject: [PATCH] From Didier Gautheron: Dissectors using call_dissector() function inside a 'if (tree) {}' block. https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4107 git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@30415 f5534014-38df-0310-8fa8-9805f1628bb7 --- epan/dissectors/packet-artnet.c | 12 +- epan/dissectors/packet-cisco-erspan.c | 9 +- epan/dissectors/packet-clnp.c | 6 +- epan/dissectors/packet-ehs.c | 205 ++++++++++++------------- epan/dissectors/packet-eigrp.c | 13 +- epan/dissectors/packet-icmpv6.c | 3 - epan/dissectors/packet-ipdc.c | 2 - epan/dissectors/packet-jabber.c | 8 +- epan/dissectors/packet-jxta.c | 6 +- epan/dissectors/packet-l2tp.c | 2 - epan/dissectors/packet-mip.c | 12 +- epan/dissectors/packet-pim.c | 2 - epan/dissectors/packet-pop.c | 173 ++++++++++----------- epan/dissectors/packet-pw-cesopsn.c | 1 - epan/dissectors/packet-stun.c | 3 - epan/dissectors/packet-turbocell.c | 6 +- epan/dissectors/packet-turnchannel.c | 3 - epan/dissectors/packet-vcdu.c | 2 +- plugins/docsis/packet-dsaack.c | 10 +- plugins/docsis/packet-dsareq.c | 8 +- plugins/docsis/packet-dsarsp.c | 8 +- plugins/docsis/packet-dscack.c | 8 +- plugins/docsis/packet-dscreq.c | 8 +- plugins/docsis/packet-dscrsp.c | 8 +- plugins/docsis/packet-dsdreq.c | 8 +- plugins/docsis/packet-regack.c | 8 +- plugins/docsis/packet-regreq.c | 8 +- plugins/docsis/packet-regreqmp.c | 8 +- plugins/docsis/packet-regrsp.c | 8 +- plugins/docsis/packet-regrspmp.c | 8 +- plugins/docsis/packet-tlv.c | 1 - plugins/docsis/packet-uccreq.c | 8 +- plugins/ethercat/packet-ecatmb.c | 1 - plugins/wimax/mac_mgmt_msg_decoder.c | 1 - plugins/wimaxasncp/packet-wimaxasncp.c | 1 - 35 files changed, 279 insertions(+), 299 deletions(-) diff --git a/epan/dissectors/packet-artnet.c b/epan/dissectors/packet-artnet.c index 4ebafc6425..b8af3bc758 100644 --- a/epan/dissectors/packet-artnet.c +++ b/epan/dissectors/packet-artnet.c @@ -1651,20 +1651,18 @@ dissect_artnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { break; case ARTNET_OP_RDM: - if (tree) { - hi = proto_tree_add_item(artnet_tree, + hi = proto_tree_add_item(artnet_tree, hf_artnet_rdm, tvb, offset, 0, FALSE); - si = proto_item_add_subtree(hi,ett_artnet); + si = proto_item_add_subtree(hi,ett_artnet); - size = dissect_artnet_rdm( tvb, offset, si, pinfo ); - size -= offset; + size = dissect_artnet_rdm( tvb, offset, si, pinfo ); + size -= offset; - proto_item_set_len( si, size ); - } + proto_item_set_len( si, size ); break; case ARTNET_OP_IP_PROG: diff --git a/epan/dissectors/packet-cisco-erspan.c b/epan/dissectors/packet-cisco-erspan.c index ce940770e1..4cc00f4556 100644 --- a/epan/dissectors/packet-cisco-erspan.c +++ b/epan/dissectors/packet-cisco-erspan.c @@ -128,10 +128,13 @@ dissect_erspan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(erspan_tree, hf_erspan_unknown4, tvb, offset, 4, FALSE); offset += 4; - - eth_tvb = tvb_new_subset_remaining(tvb, offset); - call_dissector(ethnofcs_handle, eth_tvb, pinfo, tree); } + else { + offset += 8; + } + + eth_tvb = tvb_new_subset_remaining(tvb, offset); + call_dissector(ethnofcs_handle, eth_tvb, pinfo, tree); } void diff --git a/epan/dissectors/packet-clnp.c b/epan/dissectors/packet-clnp.c index 913be638f3..04c904b878 100644 --- a/epan/dissectors/packet-clnp.c +++ b/epan/dissectors/packet-clnp.c @@ -511,9 +511,8 @@ static void dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dissect it as a CLNP PDU. */ if (check_col(pinfo->cinfo, COL_INFO)) col_add_fstr(pinfo->cinfo, COL_INFO, "%s NPDU %s", pdu_type_string, flag_string); - if (tree) { - next_length = tvb_length_remaining(tvb, offset); - if (next_length != 0) { + next_length = tvb_length_remaining(tvb, offset); + if (next_length != 0) { /* We have payload; dissect it. */ ti = proto_tree_add_text(clnp_tree, tvb, offset, next_length, "Discarded PDU"); @@ -530,7 +529,6 @@ static void dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Restore the "we're inside an error packet" flag. */ pinfo->in_error_pkt = save_in_error_pkt; - } } pinfo->fragmented = save_fragmented; return; /* we're done with this PDU */ diff --git a/epan/dissectors/packet-ehs.c b/epan/dissectors/packet-ehs.c index e15fb90d23..009660ede1 100644 --- a/epan/dissectors/packet-ehs.c +++ b/epan/dissectors/packet-ehs.c @@ -1066,113 +1066,110 @@ dissect_ehs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_PROTOCOL, "EHS"); col_set_str(pinfo->cinfo, COL_INFO, "EHS"); - if ( tree ) + ehs_packet = proto_tree_add_item ( tree, proto_ehs, tvb, 0, -1, FALSE ); + ehs_tree = proto_item_add_subtree ( ehs_packet, ett_ehs ); + + /* build the ehs primary header tree */ + ehs_primary_header = proto_tree_add_text ( ehs_tree, tvb, offset, EHS_PRIMARY_HEADER_SIZE, "Primary EHS Header" ); + ehs_primary_header_tree = proto_item_add_subtree ( ehs_primary_header, ett_ehs_primary_header ); + + proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_version, tvb, offset, 1, FALSE ); + proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_project, tvb, offset, 1, FALSE ); + ++offset; + + proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_support_mode, tvb, offset, 1, FALSE ); + proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_data_mode, tvb, offset, 1, FALSE ); + ++offset; + + proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_mission, tvb, offset, 1, FALSE ); + ++offset; + + /* save protocol for use later on */ + protocol = tvb_get_guint8 ( tvb, offset ); + proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_protocol, tvb, offset, 1, FALSE ); + ++offset; + + year = tvb_get_guint8 ( tvb, offset ); + proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_year, tvb, offset, 1, FALSE ); + ++offset; + + jday = tvb_get_ntohs ( tvb, offset ); + proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_jday, tvb, offset, 2, FALSE ); + offset += 2; + + hour = tvb_get_guint8 ( tvb, offset ); + proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_hour, tvb, offset, 1, FALSE ); + ++offset; + + minute = tvb_get_guint8 ( tvb, offset ); + proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_minute, tvb, offset, 1, FALSE ); + ++offset; + + second = tvb_get_guint8 ( tvb, offset ); + proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_second, tvb, offset, 1, FALSE ); + ++offset; + + tenths = tvb_get_guint8 ( tvb, offset ) >> 4; + proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_tenths, tvb, offset, 1, FALSE ); + + /* format a more readable ground receipt time string */ + proto_tree_add_text ( ehs_primary_header_tree, tvb, offset-7, 7, + "%04d/%03d:%02d:%02d:%02d.%1d = EHS Ground Receipt Time", year + 1900, jday, hour, minute, second, tenths ); + + proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_new_data_flag, tvb, offset, 1, FALSE ); + /* proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_pad1, tvb, offset, 1, FALSE ); */ + proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_hold_flag, tvb, offset, 1, FALSE ); + proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_sign_flag, tvb, offset, 1, FALSE ); + ++offset; + + /* proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_pad2, tvb, offset, 1, FALSE ); */ + ++offset; + /* proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_pad3, tvb, offset, 1, FALSE ); */ + ++offset; + /* proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_pad4, tvb, offset, 1, FALSE ); */ + ++offset; + + proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_hosc_packet_size, tvb, offset, 2, FALSE ); + offset += 2; + + /* build the ehs secondary header tree */ + ehs_secondary_header = proto_tree_add_text ( ehs_tree, tvb, offset, + ehs_secondary_header_size ( protocol, tvb, offset ), "Secondary EHS Header" ); + ehs_secondary_header_tree = proto_item_add_subtree ( ehs_secondary_header, ett_ehs_secondary_header ); + + /* since each protocol can have a different ehs secondary header structure, we will offload + * this processing to lower levels of code so we don't have to insert all of that complexity + * directly inline here, which would no doubt make this difficult to read at best. + */ + ehs_secondary_header_dissector ( protocol, ehs_secondary_header_tree, tvb, &offset ); + + /* for ccsds protocol types pass the remaining packet off to the ccsds packet dissector */ + switch ( protocol ) { - ehs_packet = proto_tree_add_item ( tree, proto_ehs, tvb, 0, -1, FALSE ); - ehs_tree = proto_item_add_subtree ( ehs_packet, ett_ehs ); - - /* build the ehs primary header tree */ - ehs_primary_header = proto_tree_add_text ( ehs_tree, tvb, offset, EHS_PRIMARY_HEADER_SIZE, "Primary EHS Header" ); - ehs_primary_header_tree = proto_item_add_subtree ( ehs_primary_header, ett_ehs_primary_header ); - - proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_version, tvb, offset, 1, FALSE ); - proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_project, tvb, offset, 1, FALSE ); - ++offset; - - proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_support_mode, tvb, offset, 1, FALSE ); - proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_data_mode, tvb, offset, 1, FALSE ); - ++offset; - - proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_mission, tvb, offset, 1, FALSE ); - ++offset; - - /* save protocol for use later on */ - protocol = tvb_get_guint8 ( tvb, offset ); - proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_protocol, tvb, offset, 1, FALSE ); - ++offset; - - year = tvb_get_guint8 ( tvb, offset ); - proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_year, tvb, offset, 1, FALSE ); - ++offset; - - jday = tvb_get_ntohs ( tvb, offset ); - proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_jday, tvb, offset, 2, FALSE ); - offset += 2; - - hour = tvb_get_guint8 ( tvb, offset ); - proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_hour, tvb, offset, 1, FALSE ); - ++offset; - - minute = tvb_get_guint8 ( tvb, offset ); - proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_minute, tvb, offset, 1, FALSE ); - ++offset; - - second = tvb_get_guint8 ( tvb, offset ); - proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_second, tvb, offset, 1, FALSE ); - ++offset; - - tenths = tvb_get_guint8 ( tvb, offset ) >> 4; - proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_tenths, tvb, offset, 1, FALSE ); - - /* format a more readable ground receipt time string */ - proto_tree_add_text ( ehs_primary_header_tree, tvb, offset-7, 7, - "%04d/%03d:%02d:%02d:%02d.%1d = EHS Ground Receipt Time", year + 1900, jday, hour, minute, second, tenths ); - - proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_new_data_flag, tvb, offset, 1, FALSE ); - /* proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_pad1, tvb, offset, 1, FALSE ); */ - proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_hold_flag, tvb, offset, 1, FALSE ); - proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_sign_flag, tvb, offset, 1, FALSE ); - ++offset; - - /* proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_pad2, tvb, offset, 1, FALSE ); */ - ++offset; - /* proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_pad3, tvb, offset, 1, FALSE ); */ - ++offset; - /* proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_pad4, tvb, offset, 1, FALSE ); */ - ++offset; - - proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_hosc_packet_size, tvb, offset, 2, FALSE ); - offset += 2; - - /* build the ehs secondary header tree */ - ehs_secondary_header = proto_tree_add_text ( ehs_tree, tvb, offset, - ehs_secondary_header_size ( protocol, tvb, offset ), "Secondary EHS Header" ); - ehs_secondary_header_tree = proto_item_add_subtree ( ehs_secondary_header, ett_ehs_secondary_header ); - - /* since each protocol can have a different ehs secondary header structure, we will offload - * this processing to lower levels of code so we don't have to insert all of that complexity - * directly inline here, which would no doubt make this difficult to read at best. - */ - ehs_secondary_header_dissector ( protocol, ehs_secondary_header_tree, tvb, &offset ); - - /* for ccsds protocol types pass the remaining packet off to the ccsds packet dissector */ - switch ( protocol ) - { - case EHS_PROTOCOL__TDM_TELEMETRY: - case EHS_PROTOCOL__PSEUDO_TELEMETRY: - case EHS_PROTOCOL__AOS_LOS: - case EHS_PROTOCOL__PDSS_PAYLOAD_CCSDS_PACKET: - case EHS_PROTOCOL__PDSS_CORE_CCSDS_PACKET: - case EHS_PROTOCOL__PDSS_UDSM: - new_tvb = tvb_new_subset_remaining ( tvb, offset); - call_dissector ( ccsds_handle, new_tvb, pinfo, ehs_tree ); - - /* bump the offset to the data zone area */ - first_word = tvb_get_ntohs ( tvb, offset ); - - offset += CCSDS_PRIMARY_HEADER_LENGTH; - if ( first_word & HDR_SECHDR ) offset += CCSDS_SECONDARY_HEADER_LENGTH; - break; - - - default: - break; - } - - /* build the ehs data zone tree for well known protocols such as AOS/LOS and UDSM */ - ehs_data_zone_dissector ( protocol, ehs_tree, tvb, &offset, pinfo ); + case EHS_PROTOCOL__TDM_TELEMETRY: + case EHS_PROTOCOL__PSEUDO_TELEMETRY: + case EHS_PROTOCOL__AOS_LOS: + case EHS_PROTOCOL__PDSS_PAYLOAD_CCSDS_PACKET: + case EHS_PROTOCOL__PDSS_CORE_CCSDS_PACKET: + case EHS_PROTOCOL__PDSS_UDSM: + new_tvb = tvb_new_subset_remaining ( tvb, offset); + call_dissector ( ccsds_handle, new_tvb, pinfo, ehs_tree ); + + /* bump the offset to the data zone area */ + first_word = tvb_get_ntohs ( tvb, offset ); + + offset += CCSDS_PRIMARY_HEADER_LENGTH; + if ( first_word & HDR_SECHDR ) offset += CCSDS_SECONDARY_HEADER_LENGTH; + break; + + + default: + break; } + /* build the ehs data zone tree for well known protocols such as AOS/LOS and UDSM */ + ehs_data_zone_dissector ( protocol, ehs_tree, tvb, &offset, pinfo ); + } diff --git a/epan/dissectors/packet-eigrp.c b/epan/dissectors/packet-eigrp.c index 917793df22..40270e0a8f 100644 --- a/epan/dissectors/packet-eigrp.c +++ b/epan/dissectors/packet-eigrp.c @@ -352,7 +352,7 @@ static void dissect_eigrp_ip6_ext(tvbuff_t *tvb, proto_tree *tree, proto_item *t static void dissect_eigrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - proto_tree *eigrp_tree, *tlv_tree, *eigrp_flags_tree; + proto_tree *eigrp_tree = NULL, *tlv_tree, *eigrp_flags_tree; proto_item *ti; guint opcode, opcode_tmp; @@ -378,7 +378,6 @@ static void dissect_eigrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_tree_add_item(eigrp_tree, hf_eigrp_version, tvb, 0, 1, FALSE); proto_tree_add_item(eigrp_tree, hf_eigrp_opcode, tvb, 1, 1, FALSE); proto_tree_add_item(eigrp_tree, hf_eigrp_checksum, tvb, 2, 2, FALSE); - /* Decode the EIGRP Flags Field */ ti = proto_tree_add_item(eigrp_tree, hf_eigrp_flags, tvb, 4, 4, FALSE); @@ -392,12 +391,14 @@ static void dissect_eigrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_tree_add_item(eigrp_tree, hf_eigrp_sequence, tvb, 8, 4, FALSE); proto_tree_add_item(eigrp_tree, hf_eigrp_acknowledge, tvb, 12, 4, FALSE); proto_tree_add_item(eigrp_tree, hf_eigrp_as, tvb, 16, 4, FALSE); + } - if (opcode == EIGRP_SAP) { - call_dissector(ipxsap_handle, tvb_new_subset(tvb, EIGRP_HEADER_LENGTH, -1, -1), pinfo, eigrp_tree); - return; - } + if (opcode == EIGRP_SAP) { + call_dissector(ipxsap_handle, tvb_new_subset(tvb, EIGRP_HEADER_LENGTH, -1, -1), pinfo, eigrp_tree); + return; + } + if (tree) { while (tvb_reported_length_remaining(tvb, offset) > 0) { tlv = tvb_get_ntohs(tvb, offset); diff --git a/epan/dissectors/packet-icmpv6.c b/epan/dissectors/packet-icmpv6.c index d56c17e823..84d94346e8 100644 --- a/epan/dissectors/packet-icmpv6.c +++ b/epan/dissectors/packet-icmpv6.c @@ -363,9 +363,6 @@ dissect_icmpv6ndopt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t guint32 no_of_pars; guint32 i; - if (!tree) - return; - again: if ((int)tvb_reported_length(tvb) <= offset) return; /* No more options left */ diff --git a/epan/dissectors/packet-ipdc.c b/epan/dissectors/packet-ipdc.c index 2106400e8f..78cd3cba8b 100644 --- a/epan/dissectors/packet-ipdc.c +++ b/epan/dissectors/packet-ipdc.c @@ -148,8 +148,6 @@ dissect_ipdc_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) val_to_str(message_code, message_code_vals, TEXT_UNDEFINED)); - if (!tree) - return; ti = proto_tree_add_item(tree, proto_ipdc, tvb, 0, -1, FALSE); ipdc_tree = proto_item_add_subtree(ti, ett_ipdc); diff --git a/epan/dissectors/packet-jabber.c b/epan/dissectors/packet-jabber.c index da71c1e4bc..57a461c601 100644 --- a/epan/dissectors/packet-jabber.c +++ b/epan/dissectors/packet-jabber.c @@ -52,7 +52,7 @@ static void dissect_jabber(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { gboolean is_request; - proto_tree *jabber_tree; + proto_tree *jabber_tree = NULL; proto_item *ti, *hidden_item; gint offset = 0; const guchar *line; @@ -100,10 +100,10 @@ dissect_jabber(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) hf_jabber_response, tvb, 0, 0, TRUE); } PROTO_ITEM_SET_HIDDEN(hidden_item); - - xmltvb = tvb_new_subset_remaining(tvb, offset); - call_dissector(xml_handle, xmltvb, pinfo, jabber_tree); } + + xmltvb = tvb_new_subset_remaining(tvb, offset); + call_dissector(xml_handle, xmltvb, pinfo, jabber_tree); } void diff --git a/epan/dissectors/packet-jxta.c b/epan/dissectors/packet-jxta.c index 1d395c0268..f40dec4846 100644 --- a/epan/dissectors/packet-jxta.c +++ b/epan/dissectors/packet-jxta.c @@ -477,7 +477,7 @@ static int dissect_jxta_udp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tr col_set_str(pinfo->cinfo, COL_PROTOCOL, "JXTA"); - if (tree) { + { guint tree_offset = 0; proto_item *jxta_tree_item = proto_tree_add_protocol_format(tree, proto_jxta, tvb, offset, -1, "JXTA" ); @@ -1609,7 +1609,7 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p } /* Second (optional) pass : build the proto tree */ - if (tree) { + { guint tree_offset = 0; proto_item *jxta_elem_tree_item = proto_tree_add_item(tree, hf_jxta_element, tvb, tree_offset, -1, FALSE); proto_tree *jxta_elem_tree = proto_item_add_subtree(jxta_elem_tree_item, ett_jxta_elem); @@ -1867,7 +1867,7 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p } /* Second (optional) pass : build the proto tree */ - if (tree) { + { guint tree_offset = 0; proto_item *jxta_elem_tree_item = proto_tree_add_item(tree, hf_jxta_element, tvb, tree_offset, -1, FALSE); proto_tree *jxta_elem_tree = proto_item_add_subtree(jxta_elem_tree_item, ett_jxta_elem); diff --git a/epan/dissectors/packet-l2tp.c b/epan/dissectors/packet-l2tp.c index 48014513f1..c5d0973cb5 100644 --- a/epan/dissectors/packet-l2tp.c +++ b/epan/dissectors/packet-l2tp.c @@ -601,7 +601,6 @@ static void process_control_avps(tvbuff_t *tvb, guint32 bits; guint16 firmware_rev; - if (l2tp_tree) { while (index < length) { /* Process AVP's */ ver_len_hidden = tvb_get_ntohs(tvb, index); avp_len = AVP_LENGTH(ver_len_hidden); @@ -1345,7 +1344,6 @@ static void process_control_avps(tvbuff_t *tvb, index += avp_len; } - } } /* diff --git a/epan/dissectors/packet-mip.c b/epan/dissectors/packet-mip.c index ca1d61487b..b30a090ff8 100644 --- a/epan/dissectors/packet-mip.c +++ b/epan/dissectors/packet-mip.c @@ -696,12 +696,14 @@ dissect_mip( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* reserved */ proto_tree_add_item(mip_tree, hf_mip_nattt_reserved, tvb, offset, 2, FALSE); offset += 2; - - /* encapsulated payload */ - next_tvb = tvb_new_subset_remaining(tvb, 4); - call_dissector(ip_handle, next_tvb, pinfo, mip_tree); - offset += tvb_reported_length_remaining(tvb, offset); } /* if tree */ + else { + offset += 4; + } + /* encapsulated payload */ + next_tvb = tvb_new_subset_remaining(tvb, 4); + call_dissector(ip_handle, next_tvb, pinfo, mip_tree); + offset += tvb_reported_length_remaining(tvb, offset); break; case REGISTRATION_REVOCATION: if (check_col(pinfo->cinfo, COL_INFO)) diff --git a/epan/dissectors/packet-pim.c b/epan/dissectors/packet-pim.c index 754f31a0f8..89346d97bd 100644 --- a/epan/dissectors/packet-pim.c +++ b/epan/dissectors/packet-pim.c @@ -208,7 +208,6 @@ dissect_pimv1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, offset += 3; /* skip reserved stuff */ - if (tree) { if (tvb_reported_length_remaining(tvb, offset) > 0) { tiopt = proto_tree_add_text(pim_tree, tvb, offset, -1, "PIM parameters"); @@ -469,7 +468,6 @@ dissect_pimv1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, default: break; } - } done:; return offset+tvb_length_remaining(tvb, offset); diff --git a/epan/dissectors/packet-pop.c b/epan/dissectors/packet-pop.c index 4f766fcdc3..926e68641c 100644 --- a/epan/dissectors/packet-pop.c +++ b/epan/dissectors/packet-pop.c @@ -201,115 +201,116 @@ dissect_pop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) format_text(line, linelen)); } - if (tree) { - ti = proto_tree_add_item(tree, proto_pop, tvb, offset, -1, FALSE); - pop_tree = proto_item_add_subtree(ti, ett_pop); + ti = proto_tree_add_item(tree, proto_pop, tvb, offset, -1, FALSE); + pop_tree = proto_item_add_subtree(ti, ett_pop); - if (is_continuation) { + if (is_continuation) { - if (pop_data_desegment) { + if (pop_data_desegment) { - if (!frame_data) { + if (!frame_data) { - data_val->msg_read_len += tvb_length(tvb); + data_val->msg_read_len += tvb_length(tvb); - frame_data = se_alloc(sizeof(struct pop_proto_data)); + frame_data = se_alloc(sizeof(struct pop_proto_data)); - frame_data->conversation_id = conversation->index; - frame_data->more_frags = data_val->msg_read_len < data_val->msg_tot_len; + frame_data->conversation_id = conversation->index; + frame_data->more_frags = data_val->msg_read_len < data_val->msg_tot_len; - p_add_proto_data(pinfo->fd, proto_pop, frame_data); - } + p_add_proto_data(pinfo->fd, proto_pop, frame_data); + } - frag_msg = fragment_add_seq_next(tvb, 0, pinfo, - frame_data->conversation_id, - pop_data_segment_table, - pop_data_reassembled_table, - tvb_length(tvb), - frame_data->more_frags); + frag_msg = fragment_add_seq_next(tvb, 0, pinfo, + frame_data->conversation_id, + pop_data_segment_table, + pop_data_reassembled_table, + tvb_length(tvb), + frame_data->more_frags); - next_tvb = process_reassembled_data(tvb, offset, pinfo, - "Reassembled DATA", - frag_msg, &pop_data_frag_items, - NULL, pop_tree); + next_tvb = process_reassembled_data(tvb, offset, pinfo, + "Reassembled DATA", + frag_msg, &pop_data_frag_items, + NULL, pop_tree); - if (next_tvb) { + if (next_tvb) { - if (imf_handle) - call_dissector(imf_handle, next_tvb, pinfo, tree); + if (imf_handle) + call_dissector(imf_handle, next_tvb, pinfo, tree); - if (data_val) { - /* we have read everything - reset */ - - data_val->msg_read_len = 0; - data_val->msg_tot_len = 0; - } - pinfo->fragmented = FALSE; - } else { - pinfo->fragmented = TRUE; + if (data_val) { + /* we have read everything - reset */ + + data_val->msg_read_len = 0; + data_val->msg_tot_len = 0; } - + pinfo->fragmented = FALSE; } else { - - /* - * Put the whole packet into the tree as data. - */ - call_dissector(data_handle,tvb, pinfo, pop_tree); - + pinfo->fragmented = TRUE; } - return; + + } else { + + /* + * Put the whole packet into the tree as data. + */ + call_dissector(data_handle,tvb, pinfo, pop_tree); + } + return; + } - /* - * Put the line into the protocol tree. - */ - ti = proto_tree_add_string_format(pop_tree, - (is_request) ? - hf_pop_request : - hf_pop_response, - tvb, offset, - next_offset - offset, - "", "%s", - tvb_format_text(tvb, offset, next_offset - offset)); - reqresp_tree = proto_item_add_subtree(ti, ett_pop_reqresp); + /* + * Put the line into the protocol tree. + */ + ti = proto_tree_add_string_format(pop_tree, + (is_request) ? + hf_pop_request : + hf_pop_response, + tvb, offset, + next_offset - offset, + "", "%s", + tvb_format_text(tvb, offset, next_offset - offset)); + reqresp_tree = proto_item_add_subtree(ti, ett_pop_reqresp); - /* - * Extract the first token, and, if there is a first - * token, add it as the request or reply code. - */ - tokenlen = get_token_len(line, line + linelen, &next_token); - if (tokenlen != 0) { - proto_tree_add_item(reqresp_tree, - (is_request) ? - hf_pop_request_command : - hf_pop_response_indicator, - tvb, offset, tokenlen, FALSE); - - if (data_val) { - if (is_request) { - /* see if this is RETR or TOP command */ - if (g_ascii_strncasecmp(line, "RETR", 4) == 0 || - g_ascii_strncasecmp(line, "TOP", 3) == 0) - /* the next response will tell us how many bytes */ - data_val->msg_request = TRUE; - } else { - if (data_val->msg_request) { - /* this is a response to a RETR or TOP command */ - - if (g_ascii_strncasecmp(line, "+OK ", 4) == 0) { - /* the message will be sent - work out how many bytes */ - data_val->msg_read_len = 0; - data_val->msg_tot_len = atoi(line + 4); - } - data_val->msg_request = FALSE; + /* + * Extract the first token, and, if there is a first + * token, add it as the request or reply code. + */ + tokenlen = get_token_len(line, line + linelen, &next_token); + if (tokenlen != 0) { + proto_tree_add_item(reqresp_tree, + (is_request) ? + hf_pop_request_command : + hf_pop_response_indicator, + tvb, offset, tokenlen, FALSE); + + if (data_val) { + if (is_request) { + /* see if this is RETR or TOP command */ + if (g_ascii_strncasecmp(line, "RETR", 4) == 0 || + g_ascii_strncasecmp(line, "TOP", 3) == 0) + /* the next response will tell us how many bytes */ + data_val->msg_request = TRUE; + } else { + if (data_val->msg_request) { + /* this is a response to a RETR or TOP command */ + + if (g_ascii_strncasecmp(line, "+OK ", 4) == 0) { + /* the message will be sent - work out how many bytes */ + data_val->msg_read_len = 0; + data_val->msg_tot_len = atoi(line + 4); } + data_val->msg_request = FALSE; } } - - offset += (gint) (next_token - line); - linelen -= (int) (next_token - line); } + offset += (gint) (next_token - line); + linelen -= (int) (next_token - line); + } + + + if (tree) { /* * Add the rest of the first line as request or * reply param/description. diff --git a/epan/dissectors/packet-pw-cesopsn.c b/epan/dissectors/packet-pw-cesopsn.c index 9b3fe549d2..20e5eca8f5 100644 --- a/epan/dissectors/packet-pw-cesopsn.c +++ b/epan/dissectors/packet-pw-cesopsn.c @@ -259,7 +259,6 @@ void dissect_pw_cesopsn( tvbuff_t * tvb_original } } - if (tree) { proto_item* item; item = proto_tree_add_item(tree, proto, tvb_original, 0, -1, FALSE); diff --git a/epan/dissectors/packet-stun.c b/epan/dissectors/packet-stun.c index 5fc777360f..f5c4232bcb 100644 --- a/epan/dissectors/packet-stun.c +++ b/epan/dissectors/packet-stun.c @@ -566,9 +566,6 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) msg_method_str, msg_class_str); } - if (!tree) - return tvb_length(tvb); - ti = proto_tree_add_item(tree, proto_stun, tvb, 0, -1, FALSE); stun_tree = proto_item_add_subtree(ti, ett_stun); diff --git a/epan/dissectors/packet-turbocell.c b/epan/dissectors/packet-turbocell.c index f18fa1f9ab..7c5f3f955e 100644 --- a/epan/dissectors/packet-turbocell.c +++ b/epan/dissectors/packet-turbocell.c @@ -122,12 +122,13 @@ static void dissect_turbocell(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre { proto_item *ti, *name_item; - proto_tree *turbocell_tree, *network_tree; + proto_tree *turbocell_tree = NULL, *network_tree; tvbuff_t *next_tvb; int i=0; guint8 packet_type; guint8 * str_name; guint str_len; + gint remaining_length; packet_type = tvb_get_guint8(tvb, 0); @@ -146,7 +147,6 @@ static void dissect_turbocell(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre } if (tree) { - gint remaining_length; ti = proto_tree_add_item(tree, proto_turbocell, tvb, 0, 20, FALSE); turbocell_tree = proto_item_add_subtree(ti, ett_turbocell); @@ -171,6 +171,7 @@ static void dissect_turbocell(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre proto_tree_add_item(turbocell_tree, hf_turbocell_unknown, tvb, 0x0E, 2, FALSE); proto_tree_add_item(turbocell_tree, hf_turbocell_ip, tvb, 0x10, 4, FALSE); + } remaining_length=tvb_length_remaining(tvb, 0x14); @@ -245,7 +246,6 @@ static void dissect_turbocell(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre } } } - } } /* Register the protocol with Wireshark */ diff --git a/epan/dissectors/packet-turnchannel.c b/epan/dissectors/packet-turnchannel.c index b710536f11..81f971a56e 100644 --- a/epan/dissectors/packet-turnchannel.c +++ b/epan/dissectors/packet-turnchannel.c @@ -95,9 +95,6 @@ dissect_turnchannel_message(tvbuff_t *tvb, packet_info *pinfo, if (check_col(pinfo->cinfo, COL_INFO)) col_add_fstr(pinfo->cinfo, COL_INFO, "Channel Id 0x%x", channel_id); - if (!tree) - return tvb_length(tvb); - ti = proto_tree_add_item(tree, proto_turnchannel, tvb, 0, -1, FALSE); turnchannel_tree = proto_item_add_subtree(ti, ett_turnchannel); diff --git a/epan/dissectors/packet-vcdu.c b/epan/dissectors/packet-vcdu.c index 0f3db99d51..146981f0dc 100644 --- a/epan/dissectors/packet-vcdu.c +++ b/epan/dissectors/packet-vcdu.c @@ -299,7 +299,7 @@ dissect_vcdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_set_str(pinfo->cinfo, COL_PROTOCOL, "VCDU"); col_set_str(pinfo->cinfo, COL_INFO, "Virtual Channel Data Unit"); - if (tree) { + { /* build the smex header tree */ smex_header=proto_tree_add_text(tree, tvb, offset, SMEX_HEADER_LENGTH, "SMEX Header"); smex_tree=proto_item_add_subtree(smex_header, ett_smex); diff --git a/plugins/docsis/packet-dsaack.c b/plugins/docsis/packet-dsaack.c index cabc05e1a2..098ee786ab 100644 --- a/plugins/docsis/packet-dsaack.c +++ b/plugins/docsis/packet-dsaack.c @@ -48,7 +48,7 @@ dissect_dsaack (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) { proto_item *it; - proto_tree *dsaack_tree; + proto_tree *dsaack_tree = NULL; guint16 transid; guint8 response; tvbuff_t *next_tvb; @@ -74,11 +74,11 @@ dissect_dsaack (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) FALSE); proto_tree_add_item (dsaack_tree, hf_docsis_dsaack_response, tvb, 2, 1, FALSE); - - /* Call Dissector for Appendix C TLV's */ - next_tvb = tvb_new_subset_remaining (tvb, 3); - call_dissector (docsis_tlv_handle, next_tvb, pinfo, dsaack_tree); } + + /* Call Dissector for Appendix C TLV's */ + next_tvb = tvb_new_subset_remaining (tvb, 3); + call_dissector (docsis_tlv_handle, next_tvb, pinfo, dsaack_tree); } diff --git a/plugins/docsis/packet-dsareq.c b/plugins/docsis/packet-dsareq.c index e323663a1b..acdd0c5deb 100644 --- a/plugins/docsis/packet-dsareq.c +++ b/plugins/docsis/packet-dsareq.c @@ -45,7 +45,7 @@ dissect_dsareq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) { proto_item *it; - proto_tree *dsareq_tree; + proto_tree *dsareq_tree = NULL; guint16 transid; tvbuff_t *next_tvb; @@ -67,10 +67,10 @@ dissect_dsareq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) proto_tree_add_item (dsareq_tree, hf_docsis_dsareq_tranid, tvb, 0, 2, FALSE); - /* Call Dissector for Appendix C TLV's */ - next_tvb = tvb_new_subset_remaining (tvb, 2); - call_dissector (docsis_tlv_handle, next_tvb, pinfo, dsareq_tree); } + /* Call Dissector for Appendix C TLV's */ + next_tvb = tvb_new_subset_remaining (tvb, 2); + call_dissector (docsis_tlv_handle, next_tvb, pinfo, dsareq_tree); } diff --git a/plugins/docsis/packet-dsarsp.c b/plugins/docsis/packet-dsarsp.c index b2421921da..02da937aba 100644 --- a/plugins/docsis/packet-dsarsp.c +++ b/plugins/docsis/packet-dsarsp.c @@ -48,7 +48,7 @@ dissect_dsarsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) { proto_item *it; - proto_tree *dsarsp_tree; + proto_tree *dsarsp_tree = NULL; guint16 transid; guint8 response; tvbuff_t *next_tvb; @@ -75,10 +75,10 @@ dissect_dsarsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) proto_tree_add_item (dsarsp_tree, hf_docsis_dsarsp_response, tvb, 2, 1, FALSE); - /* Call dissector for Appendix C TLV's */ - next_tvb = tvb_new_subset_remaining (tvb, 3); - call_dissector (docsis_tlv_handle, next_tvb, pinfo, dsarsp_tree); } + /* Call dissector for Appendix C TLV's */ + next_tvb = tvb_new_subset_remaining (tvb, 3); + call_dissector (docsis_tlv_handle, next_tvb, pinfo, dsarsp_tree); diff --git a/plugins/docsis/packet-dscack.c b/plugins/docsis/packet-dscack.c index 15a532fe34..884ba4a991 100644 --- a/plugins/docsis/packet-dscack.c +++ b/plugins/docsis/packet-dscack.c @@ -48,7 +48,7 @@ dissect_dscack (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) { proto_item *it; - proto_tree *dscack_tree; + proto_tree *dscack_tree = NULL; guint16 transid; guint8 response; tvbuff_t *next_tvb; @@ -74,10 +74,10 @@ dissect_dscack (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) FALSE); proto_tree_add_item (dscack_tree, hf_docsis_dscack_response, tvb, 2, 1, FALSE); - /* Call Dissector for Appendix C TLV's */ - next_tvb = tvb_new_subset_remaining (tvb, 3); - call_dissector (docsis_tlv_handle, next_tvb, pinfo, dscack_tree); } + /* Call Dissector for Appendix C TLV's */ + next_tvb = tvb_new_subset_remaining (tvb, 3); + call_dissector (docsis_tlv_handle, next_tvb, pinfo, dscack_tree); diff --git a/plugins/docsis/packet-dscreq.c b/plugins/docsis/packet-dscreq.c index 20edeb7b17..9bbcc54b41 100644 --- a/plugins/docsis/packet-dscreq.c +++ b/plugins/docsis/packet-dscreq.c @@ -45,7 +45,7 @@ dissect_dscreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) { proto_item *it; - proto_tree *dscreq_tree; + proto_tree *dscreq_tree = NULL; guint16 transid; tvbuff_t *next_tvb; @@ -68,10 +68,10 @@ dissect_dscreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) proto_tree_add_item (dscreq_tree, hf_docsis_dscreq_tranid, tvb, 0, 2, FALSE); - /* Call dissector for Appendix C TLV's */ - next_tvb = tvb_new_subset_remaining (tvb, 2); - call_dissector (docsis_tlv_handle, next_tvb, pinfo, dscreq_tree); } + /* Call dissector for Appendix C TLV's */ + next_tvb = tvb_new_subset_remaining (tvb, 2); + call_dissector (docsis_tlv_handle, next_tvb, pinfo, dscreq_tree); } diff --git a/plugins/docsis/packet-dscrsp.c b/plugins/docsis/packet-dscrsp.c index a51cceed79..5b6906620a 100644 --- a/plugins/docsis/packet-dscrsp.c +++ b/plugins/docsis/packet-dscrsp.c @@ -48,7 +48,7 @@ dissect_dscrsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) { proto_item *it; - proto_tree *dscrsp_tree; + proto_tree *dscrsp_tree = NULL; guint16 transid; guint8 response; tvbuff_t *next_tvb; @@ -76,10 +76,10 @@ dissect_dscrsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) proto_tree_add_item (dscrsp_tree, hf_docsis_dscrsp_response, tvb, 2, 1, FALSE); - /* Call Dissector for Appendix C TLV's */ - next_tvb = tvb_new_subset_remaining (tvb, 3); - call_dissector (docsis_tlv_handle, next_tvb, pinfo, dscrsp_tree); } + /* Call Dissector for Appendix C TLV's */ + next_tvb = tvb_new_subset_remaining (tvb, 3); + call_dissector (docsis_tlv_handle, next_tvb, pinfo, dscrsp_tree); } diff --git a/plugins/docsis/packet-dsdreq.c b/plugins/docsis/packet-dsdreq.c index a11e1cac41..50cb7258a7 100644 --- a/plugins/docsis/packet-dsdreq.c +++ b/plugins/docsis/packet-dsdreq.c @@ -48,7 +48,7 @@ dissect_dsdreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) { proto_item *it; - proto_tree *dsdreq_tree; + proto_tree *dsdreq_tree = NULL; guint16 transid; tvbuff_t *next_tvb; @@ -73,10 +73,10 @@ dissect_dsdreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) proto_tree_add_item (dsdreq_tree, hf_docsis_dsdreq_sfid, tvb, 4, 4, FALSE); - /* Call Dissector for Appendix C TLV's */ - next_tvb = tvb_new_subset_remaining (tvb, 8); - call_dissector (docsis_tlv_handle, next_tvb, pinfo, dsdreq_tree); } + /* Call Dissector for Appendix C TLV's */ + next_tvb = tvb_new_subset_remaining (tvb, 8); + call_dissector (docsis_tlv_handle, next_tvb, pinfo, dsdreq_tree); } diff --git a/plugins/docsis/packet-regack.c b/plugins/docsis/packet-regack.c index 84e4a7d21c..62c4b68c2f 100644 --- a/plugins/docsis/packet-regack.c +++ b/plugins/docsis/packet-regack.c @@ -48,7 +48,7 @@ dissect_regack (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) { proto_item *it; - proto_tree *regack_tree; + proto_tree *regack_tree = NULL; guint16 sid; guint8 response; tvbuff_t *next_tvb; @@ -74,10 +74,10 @@ dissect_regack (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) proto_tree_add_item (regack_tree, hf_docsis_regack_response, tvb, 2, 1, FALSE); - /* Call Dissector for Appendix C TLV's */ - next_tvb = tvb_new_subset_remaining (tvb, 3); - call_dissector (docsis_tlv_handle, next_tvb, pinfo, regack_tree); } + /* Call Dissector for Appendix C TLV's */ + next_tvb = tvb_new_subset_remaining (tvb, 3); + call_dissector (docsis_tlv_handle, next_tvb, pinfo, regack_tree); } diff --git a/plugins/docsis/packet-regreq.c b/plugins/docsis/packet-regreq.c index d3258877fc..246f385ed7 100644 --- a/plugins/docsis/packet-regreq.c +++ b/plugins/docsis/packet-regreq.c @@ -46,7 +46,7 @@ dissect_regreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) { proto_item *it; - proto_tree *regreq_tree; + proto_tree *regreq_tree = NULL; guint16 sid; tvbuff_t *next_tvb; @@ -67,10 +67,10 @@ dissect_regreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) regreq_tree = proto_item_add_subtree (it, ett_docsis_regreq); proto_tree_add_item (regreq_tree, hf_docsis_regreq_sid, tvb, 0, 2, FALSE); - /* Call Dissector for Appendix C TlV's */ - next_tvb = tvb_new_subset_remaining (tvb, 2); - call_dissector (docsis_tlv_handle, next_tvb, pinfo, regreq_tree); } + /* Call Dissector for Appendix C TlV's */ + next_tvb = tvb_new_subset_remaining (tvb, 2); + call_dissector (docsis_tlv_handle, next_tvb, pinfo, regreq_tree); diff --git a/plugins/docsis/packet-regreqmp.c b/plugins/docsis/packet-regreqmp.c index d3a776a5c2..668e63dbbd 100644 --- a/plugins/docsis/packet-regreqmp.c +++ b/plugins/docsis/packet-regreqmp.c @@ -52,7 +52,7 @@ dissect_regreqmp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) { proto_item *it; - proto_tree *regreqmp_tree; + proto_tree *regreqmp_tree = NULL; tvbuff_t *next_tvb; col_set_str(pinfo->cinfo, COL_INFO, "REG-REQ-MP Message:"); @@ -66,10 +66,10 @@ dissect_regreqmp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) proto_tree_add_item (regreqmp_tree, hf_docsis_regreqmp_number_of_fragments, tvb, 2, 1, FALSE); proto_tree_add_item (regreqmp_tree, hf_docsis_regreqmp_fragment_sequence_number, tvb, 3, 1, FALSE); - /* Call Dissector for Appendix C TLV's */ - next_tvb = tvb_new_subset_remaining (tvb, 4); - call_dissector (docsis_tlv_handle, next_tvb, pinfo, regreqmp_tree); } + /* Call Dissector for Appendix C TLV's */ + next_tvb = tvb_new_subset_remaining (tvb, 4); + call_dissector (docsis_tlv_handle, next_tvb, pinfo, regreqmp_tree); } diff --git a/plugins/docsis/packet-regrsp.c b/plugins/docsis/packet-regrsp.c index eec7883398..e647c79816 100644 --- a/plugins/docsis/packet-regrsp.c +++ b/plugins/docsis/packet-regrsp.c @@ -49,7 +49,7 @@ dissect_regrsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) { proto_item *it; - proto_tree *regrsp_tree; + proto_tree *regrsp_tree = NULL; guint16 sid; guint8 response; tvbuff_t *next_tvb; @@ -75,10 +75,10 @@ dissect_regrsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) FALSE); proto_tree_add_item (regrsp_tree, hf_docsis_regrsp_response, tvb, 2, 1, FALSE); - /* Call Dissector for Appendix C TLV's */ - next_tvb = tvb_new_subset_remaining (tvb, 3); - call_dissector (docsis_tlv_handle, next_tvb, pinfo, regrsp_tree); } + /* Call Dissector for Appendix C TLV's */ + next_tvb = tvb_new_subset_remaining (tvb, 3); + call_dissector (docsis_tlv_handle, next_tvb, pinfo, regrsp_tree); } diff --git a/plugins/docsis/packet-regrspmp.c b/plugins/docsis/packet-regrspmp.c index 92975ccfd2..5c976d9b06 100644 --- a/plugins/docsis/packet-regrspmp.c +++ b/plugins/docsis/packet-regrspmp.c @@ -54,7 +54,7 @@ static void dissect_regrspmp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) { proto_item *it; - proto_tree *regrspmp_tree; + proto_tree *regrspmp_tree = NULL; tvbuff_t *next_tvb; @@ -72,10 +72,10 @@ dissect_regrspmp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) proto_tree_add_item (regrspmp_tree, hf_docsis_regrspmp_number_of_fragments, tvb, 3, 1, FALSE); proto_tree_add_item (regrspmp_tree, hf_docsis_regrspmp_fragment_sequence_number, tvb, 4, 1, FALSE); - /* Call Dissector for Appendix C TLV's */ - next_tvb = tvb_new_subset_remaining (tvb, 5); - call_dissector (docsis_tlv_handle, next_tvb, pinfo, regrspmp_tree); } + /* Call Dissector for Appendix C TLV's */ + next_tvb = tvb_new_subset_remaining (tvb, 5); + call_dissector (docsis_tlv_handle, next_tvb, pinfo, regrspmp_tree); } diff --git a/plugins/docsis/packet-tlv.c b/plugins/docsis/packet-tlv.c index bd0b392d34..e7e16a9c0a 100644 --- a/plugins/docsis/packet-tlv.c +++ b/plugins/docsis/packet-tlv.c @@ -1780,7 +1780,6 @@ dissect_tlv (tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree * tree) total_len = tvb_reported_length_remaining (tvb, 0); - if (tree) { it = proto_tree_add_protocol_format (tree, proto_docsis_tlv, tvb, 0, diff --git a/plugins/docsis/packet-uccreq.c b/plugins/docsis/packet-uccreq.c index adb61f5708..ba5aa25384 100644 --- a/plugins/docsis/packet-uccreq.c +++ b/plugins/docsis/packet-uccreq.c @@ -45,7 +45,7 @@ dissect_uccreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) { proto_item *it; - proto_tree *uccreq_tree; + proto_tree *uccreq_tree = NULL; guint8 chid; tvbuff_t *next_tvb; @@ -68,10 +68,10 @@ dissect_uccreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) proto_tree_add_item (uccreq_tree, hf_docsis_uccreq_upchid, tvb, 0, 1, FALSE); - /* call dissector for Appendix C TLV's */ - next_tvb = tvb_new_subset_remaining (tvb, 1); - call_dissector (docsis_tlv_handle, next_tvb, pinfo, uccreq_tree); } + /* call dissector for Appendix C TLV's */ + next_tvb = tvb_new_subset_remaining (tvb, 1); + call_dissector (docsis_tlv_handle, next_tvb, pinfo, uccreq_tree); } diff --git a/plugins/ethercat/packet-ecatmb.c b/plugins/ethercat/packet-ecatmb.c index 13dc5072eb..37b549c30a 100644 --- a/plugins/ethercat/packet-ecatmb.c +++ b/plugins/ethercat/packet-ecatmb.c @@ -1043,7 +1043,6 @@ static void dissect_ecat_eoe(tvbuff_t *tvb, gint offset, packet_info *pinfo, pro col_append_str(pinfo->cinfo, COL_INFO, szText); } - if( tree ) { ecat_eoe_tree = proto_item_add_subtree(anItem, ett_ecat_mailbox_eoe); diff --git a/plugins/wimax/mac_mgmt_msg_decoder.c b/plugins/wimax/mac_mgmt_msg_decoder.c index f1dcaebe6e..27b1134de2 100644 --- a/plugins/wimax/mac_mgmt_msg_decoder.c +++ b/plugins/wimax/mac_mgmt_msg_decoder.c @@ -195,7 +195,6 @@ void dissect_mac_mgmt_msg_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree proto_item *message_item = NULL; proto_tree *message_tree = NULL; - if (tree) { /* we are being asked for details */ /* Get the tvb reported length */ tvb_len = tvb_reported_length(tvb); diff --git a/plugins/wimaxasncp/packet-wimaxasncp.c b/plugins/wimaxasncp/packet-wimaxasncp.c index 135d5877d1..dbb0466995 100644 --- a/plugins/wimaxasncp/packet-wimaxasncp.c +++ b/plugins/wimaxasncp/packet-wimaxasncp.c @@ -1474,7 +1474,6 @@ static void wimaxasncp_dissect_tlv_value( } - if (tree) { proto_tree *eap_tree; proto_item *item; -- 2.34.1