aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-wccp.c
diff options
context:
space:
mode:
authorAlexis La Goutte <alexis.lagoutte@gmail.com>2014-11-26 15:20:27 +0100
committerAlexis La Goutte <alexis.lagoutte@gmail.com>2014-11-26 16:32:57 +0000
commita159cedd5bc3a39c29f9a9952b5f202cb6565f0b (patch)
tree8b060750f6b156b99d4e0b34d7ef9a7dd116ee01 /epan/dissectors/packet-wccp.c
parenta2c2f872f4eb2ba393d091a5623b1168689e6b09 (diff)
WCCP: Remove uneeded check (pinfo & info_tree)
Remove also some false positive Dereference of null pointer Change-Id: I09687993531827c6e4f5178f3414ddd9a2702038 Reviewed-on: https://code.wireshark.org/review/5506 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Evan Huus <eapache@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-wccp.c')
-rw-r--r--epan/dissectors/packet-wccp.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/epan/dissectors/packet-wccp.c b/epan/dissectors/packet-wccp.c
index 70dd456668..88ce88f1d0 100644
--- a/epan/dissectors/packet-wccp.c
+++ b/epan/dissectors/packet-wccp.c
@@ -1870,29 +1870,24 @@ dissect_wccp2r1_address_table_info(tvbuff_t *tvb, int offset,
wccp_wccp_address_table.in_use = TRUE;
- if (info_tree)
- tf = proto_tree_get_parent(info_tree);
-
if (length < 2*4)
return length - 2*4;
wccp_wccp_address_table.family = tvb_get_ntohs(tvb,offset);
- if (pinfo && info_tree)
- proto_tree_add_item(info_tree, hf_address_table_family, tvb,
+
+ proto_tree_add_item(info_tree, hf_address_table_family, tvb,
offset, 2, ENC_BIG_ENDIAN);
EAT_AND_CHECK(2,2);
address_length = tvb_get_ntohs(tvb,offset);
- if (info_tree)
- proto_tree_add_item(info_tree, hf_address_table_address_length, tvb, offset, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(info_tree, hf_address_table_address_length, tvb, offset, 2, ENC_BIG_ENDIAN);
EAT_AND_CHECK(2,2);
wccp_wccp_address_table.table_length = tvb_get_ntohl(tvb,offset);
- if (pinfo && info_tree) {
- tf = proto_tree_add_item(info_tree, hf_address_table_length, tvb, offset, 4, ENC_BIG_ENDIAN);
- element_tree = proto_item_add_subtree(tf, ett_table_element);
- }
+ tf = proto_tree_add_item(info_tree, hf_address_table_length, tvb, offset, 4, ENC_BIG_ENDIAN);
+ element_tree = proto_item_add_subtree(tf, ett_table_element);
+
EAT(4);
/* check if the length is valid and allocate the tables if needed*/
@@ -1901,7 +1896,7 @@ dissect_wccp2r1_address_table_info(tvbuff_t *tvb, int offset,
if (wccp_wccp_address_table.table_ipv4 == NULL)
wccp_wccp_address_table.table_ipv4 = (guint32 *)
wmem_alloc(pinfo->pool, wccp_wccp_address_table.table_length * 4);
- if ((address_length != 4) && (pinfo && info_tree)) {
+ if (address_length != 4) {
expert_add_info_format(pinfo, tf, &ei_wccp_length_bad,
"The Address length must be 4, but I found %d for IPv4 addresses. Correcting this.",
address_length);
@@ -1912,7 +1907,7 @@ dissect_wccp2r1_address_table_info(tvbuff_t *tvb, int offset,
if (wccp_wccp_address_table.table_ipv6 == NULL)
wccp_wccp_address_table.table_ipv6 = (struct e_in6_addr *)
wmem_alloc(pinfo->pool, wccp_wccp_address_table.table_length * sizeof(struct e_in6_addr));
- if ((address_length != 16) && (pinfo && info_tree)) {
+ if (address_length != 16) {
expert_add_info_format(pinfo, tf, &ei_wccp_length_bad,
"The Address length must be 16, but I found %d for IPv6 addresses. Correcting this",
address_length);
@@ -1920,10 +1915,8 @@ dissect_wccp2r1_address_table_info(tvbuff_t *tvb, int offset,
}
break;
default:
- if (pinfo && info_tree) {
- expert_add_info_format(pinfo, tf, &ei_wccp_address_table_family_unknown,
+ expert_add_info_format(pinfo, tf, &ei_wccp_address_table_family_unknown,
"Unknown address family: %d", wccp_wccp_address_table.family);
- }
};
/* now read the addresses and print/store them */
@@ -1933,8 +1926,7 @@ dissect_wccp2r1_address_table_info(tvbuff_t *tvb, int offset,
/* do we have space? */
if (length < address_length) {
- if (pinfo && tf)
- expert_add_info_format(pinfo, tf, &ei_wccp_length_bad, "Ran out of space to decode");
+ expert_add_info_format(pinfo, tf, &ei_wccp_length_bad, "Ran out of space to decode");
/* first clean up: */
wccp_wccp_address_table.in_use = FALSE;