aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-cops.c
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2016-12-06 17:46:09 +0100
committerPeter Wu <peter@lekensteyn.nl>2016-12-07 00:46:10 +0000
commit47829b9611b613425aa0a314224863b02b915ea2 (patch)
tree1013a5d17ed467c34c6c52fda9d87b62daba9187 /epan/dissectors/packet-cops.c
parentae989a5d0642c9de4458a2e8bbfd5f288193a6f5 (diff)
cops: try to avoid uninitialized warning error
Valgrind 3.11.0 on the Ubuntu 16.04 buildbot reports that cops_call->solicited is not initialized: pdus_array = (GPtrArray *)wmem_map_lookup(cops_conv_info->pdus_tree, GUINT_TO_POINTER(handle_value)); /* ... */ for (i=0; i < pdus_array->len; i++) { cops_call = (cops_call_t*)g_ptr_array_index(pdus_array, i); if ( /* ... */ ( (cops_call->op_code == COPS_MSG_KA && !(cops_call->solicited)) && ^^^^^^^^^^^^^^^^^^^^ which is clearly bogus since the only place where cops_call could be created is a few lines up: ver_flags = tvb_get_guint8(tvb, offset); is_solicited = (lo_nibble(ver_flags) == 0x01); /* ... */ pdus_array = (GPtrArray *)wmem_map_lookup(cops_conv_info->pdus_tree, GUINT_TO_POINTER(handle_value)); if (pdus_array == NULL) { pdus_array = g_ptr_array_new(); wmem_map_insert(cops_conv_info->pdus_tree, GUINT_TO_POINTER(handle_value), pdus_array); } /* ... */ cops_call = wmem_new(wmem_file_scope(), cops_call_t); cops_call->op_code = op_code; cops_call->solicited = is_solicited; /* ... */ g_ptr_array_add(pdus_array, cops_call); Try to zero the whole structure to avoid this bogus warning. Change-Id: I1ec4d23e99c987849af580a1c8134610c383e55e Ping-Bug: 13044 Ping-Bug: 13203 Reviewed-on: https://code.wireshark.org/review/19119 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'epan/dissectors/packet-cops.c')
-rw-r--r--epan/dissectors/packet-cops.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/epan/dissectors/packet-cops.c b/epan/dissectors/packet-cops.c
index 8bb293d48d..b727c6b5f1 100644
--- a/epan/dissectors/packet-cops.c
+++ b/epan/dissectors/packet-cops.c
@@ -1052,7 +1052,7 @@ dissect_cops_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
}
if (!pinfo->fd->flags.visited) {
- cops_call = wmem_new(wmem_file_scope(), cops_call_t);
+ cops_call = wmem_new0(wmem_file_scope(), cops_call_t);
cops_call->op_code = op_code;
cops_call->solicited = is_solicited;
cops_call->req_num = pinfo->num;