diff options
author | Kovarththanan Rajaratnam <kovarththanan.rajaratnam@gmail.com> | 2009-08-17 11:21:33 +0000 |
---|---|---|
committer | Kovarththanan Rajaratnam <kovarththanan.rajaratnam@gmail.com> | 2009-08-17 11:21:33 +0000 |
commit | 460eacaae16a123d54e841840e76751d11177f18 (patch) | |
tree | 0950f3e9fe806fbad1fc94eac4e57a351da58a57 /epan/proto.c | |
parent | 69babcb4a636fab71e3453f11e82156ba4a6568b (diff) |
Move the NULL pointer 'tree' check under TRY_TO_FAKE_THIS_ITEMs umbrella
svn path=/trunk/; revision=29453
Diffstat (limited to 'epan/proto.c')
-rw-r--r-- | epan/proto.c | 64 |
1 files changed, 2 insertions, 62 deletions
diff --git a/epan/proto.c b/epan/proto.c index dfdfc208db..acdfacd75b 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -99,6 +99,8 @@ wrs_count_bitshift(guint32 bitmask) We fake FT_PROTOCOL unless some clients have requested us \ not to do so. \ */ \ + if (!tree) \ + return(NULL); \ PROTO_REGISTRAR_GET_NTH(hfindex, hfinfo); \ if(!(PTREE_DATA(tree)->visible)){ \ if(PTREE_FINFO(tree)){ \ @@ -948,9 +950,6 @@ proto_tree_add_text_node(proto_tree *tree, tvbuff_t *tvb, gint start, gint lengt proto_item *pi; header_field_info *hfinfo; - if (!tree) - return(NULL); - TRY_TO_FAKE_THIS_ITEM(tree, hf_text_only, hfinfo); pi = proto_tree_add_pi(tree, hf_text_only, tvb, start, &length, NULL); @@ -1386,8 +1385,6 @@ ptvcursor_add(ptvcursor_t *ptvc, int hfindex, gint length, n = get_uint_value(ptvc->tvb, offset, length, little_endian); ptvc->offset += n; } - if (ptvc->tree == NULL) - return NULL; TRY_TO_FAKE_THIS_ITEM(ptvc->tree, hfindex, hfinfo); @@ -1409,9 +1406,6 @@ proto_tree_add_item(proto_tree *tree, int hfindex, tvbuff_t *tvb, field_info *new_fi; header_field_info *hfinfo; - if (!tree) - return(NULL); - TRY_TO_FAKE_THIS_ITEM(tree, hfindex, hfinfo); new_fi = alloc_field_info(tree, hfindex, tvb, start, &length); @@ -1432,9 +1426,6 @@ proto_tree_add_none_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint st va_list ap; header_field_info *hfinfo; - if (!tree) - return (NULL); - TRY_TO_FAKE_THIS_ITEM(tree, hfindex, hfinfo); DISSECTOR_ASSERT(hfinfo->type == FT_NONE); @@ -1488,9 +1479,6 @@ proto_tree_add_protocol_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gin field_info *new_fi; header_field_info *hfinfo; - if (!tree) - return (NULL); - TRY_TO_FAKE_THIS_ITEM(tree, hfindex, hfinfo); DISSECTOR_ASSERT(hfinfo->type == FT_PROTOCOL); @@ -1520,9 +1508,6 @@ proto_tree_add_bytes(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, field_info *new_fi; header_field_info *hfinfo; - if (!tree) - return (NULL); - TRY_TO_FAKE_THIS_ITEM(tree, hfindex, hfinfo); DISSECTOR_ASSERT(hfinfo->type == FT_BYTES); @@ -1600,9 +1585,6 @@ proto_tree_add_time(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gi field_info *new_fi; header_field_info *hfinfo; - if (!tree) - return (NULL); - TRY_TO_FAKE_THIS_ITEM(tree, hfindex, hfinfo); DISSECTOR_ASSERT(hfinfo->type == FT_ABSOLUTE_TIME || @@ -1677,9 +1659,6 @@ proto_tree_add_ipxnet(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, field_info *new_fi; header_field_info *hfinfo; - if (!tree) - return (NULL); - TRY_TO_FAKE_THIS_ITEM(tree, hfindex, hfinfo); DISSECTOR_ASSERT(hfinfo->type == FT_IPXNET); @@ -1742,9 +1721,6 @@ proto_tree_add_ipv4(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gi field_info *new_fi; header_field_info *hfinfo; - if (!tree) - return (NULL); - TRY_TO_FAKE_THIS_ITEM(tree, hfindex, hfinfo); DISSECTOR_ASSERT(hfinfo->type == FT_IPv4); @@ -1809,9 +1785,6 @@ proto_tree_add_ipv6(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gi field_info *new_fi; header_field_info *hfinfo; - if (!tree) - return (NULL); - TRY_TO_FAKE_THIS_ITEM(tree, hfindex, hfinfo); DISSECTOR_ASSERT(hfinfo->type == FT_IPv6); @@ -1882,9 +1855,6 @@ proto_tree_add_guid(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gi field_info *new_fi; header_field_info *hfinfo; - if (!tree) - return (NULL); - TRY_TO_FAKE_THIS_ITEM(tree, hfindex, hfinfo); DISSECTOR_ASSERT(hfinfo->type == FT_GUID); @@ -1960,9 +1930,6 @@ proto_tree_add_oid(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gin field_info *new_fi; header_field_info *hfinfo; - if (!tree) - return (NULL); - TRY_TO_FAKE_THIS_ITEM(tree, hfindex, hfinfo); DISSECTOR_ASSERT(hfinfo->type == FT_OID); @@ -2089,9 +2056,6 @@ proto_tree_add_string(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, field_info *new_fi; header_field_info *hfinfo; - if (!tree) - return (NULL); - TRY_TO_FAKE_THIS_ITEM(tree, hfindex, hfinfo); DISSECTOR_ASSERT(hfinfo->type == FT_STRING || hfinfo->type == FT_STRINGZ); @@ -2230,9 +2194,6 @@ proto_tree_add_ether(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, g field_info *new_fi; header_field_info *hfinfo; - if (!tree) - return (NULL); - TRY_TO_FAKE_THIS_ITEM(tree, hfindex, hfinfo); DISSECTOR_ASSERT(hfinfo->type == FT_ETHER); @@ -2303,9 +2264,6 @@ proto_tree_add_boolean(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, field_info *new_fi; header_field_info *hfinfo; - if (!tree) - return (NULL); - TRY_TO_FAKE_THIS_ITEM(tree, hfindex, hfinfo); DISSECTOR_ASSERT(hfinfo->type == FT_BOOLEAN); @@ -2369,9 +2327,6 @@ proto_tree_add_float(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, g field_info *new_fi; header_field_info *hfinfo; - if (!tree) - return (NULL); - TRY_TO_FAKE_THIS_ITEM(tree, hfindex, hfinfo); DISSECTOR_ASSERT(hfinfo->type == FT_FLOAT); @@ -2436,9 +2391,6 @@ proto_tree_add_double(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, field_info *new_fi; header_field_info *hfinfo; - if (!tree) - return (NULL); - TRY_TO_FAKE_THIS_ITEM(tree, hfindex, hfinfo); DISSECTOR_ASSERT(hfinfo->type == FT_DOUBLE); @@ -2503,9 +2455,6 @@ proto_tree_add_uint(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gi field_info *new_fi; header_field_info *hfinfo; - if (!tree) - return (NULL); - TRY_TO_FAKE_THIS_ITEM(tree, hfindex, hfinfo); switch(hfinfo->type) { @@ -2611,9 +2560,6 @@ proto_tree_add_uint64(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, field_info *new_fi; header_field_info *hfinfo; - if (!tree) - return (NULL); - TRY_TO_FAKE_THIS_ITEM(tree, hfindex, hfinfo); DISSECTOR_ASSERT(hfinfo->type == FT_UINT64); @@ -2669,9 +2615,6 @@ proto_tree_add_int(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, gin field_info *new_fi; header_field_info *hfinfo; - if (!tree) - return (NULL); - TRY_TO_FAKE_THIS_ITEM(tree, hfindex, hfinfo); switch(hfinfo->type) { @@ -2770,9 +2713,6 @@ proto_tree_add_int64(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start, g field_info *new_fi; header_field_info *hfinfo; - if (!tree) - return (NULL); - TRY_TO_FAKE_THIS_ITEM(tree, hfindex, hfinfo); DISSECTOR_ASSERT(hfinfo->type == FT_INT64); |