aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-moldudp.c
diff options
context:
space:
mode:
authorBill Meier <wmeier@newsguy.com>2012-06-12 21:22:46 +0000
committerBill Meier <wmeier@newsguy.com>2012-06-12 21:22:46 +0000
commit1b17369504e600fbddc53c67d634039ba37ac6b7 (patch)
tree3bf66240055157786e65245a2966939bf0d571c7 /epan/dissectors/packet-moldudp.c
parent5b53b81835a64b5219236922c7c91e7d9c3c1efb (diff)
Fix: code under 'if(tree)' (in)directly calls sub-dissector/col_...()/expert...() fcns
svn path=/trunk/; revision=43226
Diffstat (limited to 'epan/dissectors/packet-moldudp.c')
-rw-r--r--epan/dissectors/packet-moldudp.c63
1 files changed, 30 insertions, 33 deletions
diff --git a/epan/dissectors/packet-moldudp.c b/epan/dissectors/packet-moldudp.c
index e7be6b4e01..b480aa01df 100644
--- a/epan/dissectors/packet-moldudp.c
+++ b/epan/dissectors/packet-moldudp.c
@@ -147,40 +147,37 @@ dissect_moldudp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
else
col_set_str(pinfo->cinfo, COL_INFO, "MoldUDP Messages");
- if (tree)
+ /* create display subtree for the protocol */
+ ti = proto_tree_add_item(tree, proto_moldudp,
+ tvb, offset, -1, ENC_NA);
+
+ moldudp_tree = proto_item_add_subtree(ti, ett_moldudp);
+
+ proto_tree_add_item(moldudp_tree, hf_moldudp_session,
+ tvb, offset, MOLDUDP_SESSION_LEN, ENC_ASCII|ENC_NA);
+ offset += MOLDUDP_SESSION_LEN;
+
+ sequence = tvb_get_letohl(tvb, offset);
+ proto_tree_add_item(moldudp_tree, hf_moldudp_sequence,
+ tvb, offset, MOLDUDP_SEQUENCE_LEN, ENC_LITTLE_ENDIAN);
+ offset += MOLDUDP_SEQUENCE_LEN;
+
+ ti = proto_tree_add_item(moldudp_tree, hf_moldudp_count,
+ tvb, offset, MOLDUDP_COUNT_LEN, ENC_LITTLE_ENDIAN);
+ offset += MOLDUDP_COUNT_LEN;
+
+ while (tvb_reported_length(tvb) >= offset + MOLDUDP_MSGLEN_LEN)
{
- /* create display subtree for the protocol */
- ti = proto_tree_add_item(tree, proto_moldudp,
- tvb, offset, -1, ENC_NA);
-
- moldudp_tree = proto_item_add_subtree(ti, ett_moldudp);
-
- proto_tree_add_item(moldudp_tree, hf_moldudp_session,
- tvb, offset, MOLDUDP_SESSION_LEN, ENC_ASCII|ENC_NA);
- offset += MOLDUDP_SESSION_LEN;
-
- sequence = tvb_get_letohl(tvb, offset);
- proto_tree_add_item(moldudp_tree, hf_moldudp_sequence,
- tvb, offset, MOLDUDP_SEQUENCE_LEN, ENC_LITTLE_ENDIAN);
- offset += MOLDUDP_SEQUENCE_LEN;
-
- ti = proto_tree_add_item(moldudp_tree, hf_moldudp_count,
- tvb, offset, MOLDUDP_COUNT_LEN, ENC_LITTLE_ENDIAN);
- offset += MOLDUDP_COUNT_LEN;
-
- while (tvb_reported_length(tvb) >= offset + MOLDUDP_MSGLEN_LEN)
- {
- offset += dissect_moldudp_msgblk(tvb, pinfo, moldudp_tree,
- offset, sequence++);
- real_count++;
- }
-
- if (real_count != count)
- {
- expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR,
- "Invalid Message Count (claimed %u, found %u)",
- count, real_count);
- }
+ offset += dissect_moldudp_msgblk(tvb, pinfo, moldudp_tree,
+ offset, sequence++);
+ real_count++;
+ }
+
+ if (real_count != count)
+ {
+ expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR,
+ "Invalid Message Count (claimed %u, found %u)",
+ count, real_count);
}
/* Return the amount of data this dissector was able to dissect */