Wireshark-commits: [Wireshark-commits] master 47829b9: cops: try to avoid uninitialized warning err
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=47829b9611b613425aa0a314224863b02b915ea2
Submitter: Peter Wu (peter@xxxxxxxxxxxxx)
Changed: branch: master
Repository: wireshark
Commits:
47829b9 by Peter Wu (peter@xxxxxxxxxxxxx):
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@xxxxxxxxxxxx>
Petri-Dish: Peter Wu <peter@xxxxxxxxxxxxx>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@xxxxxxxxxxxxx>
Reviewed-by: Peter Wu <peter@xxxxxxxxxxxxx>
Actions performed:
from ae989a5 Bluetooth: SMP: Indicate when keys are Debug
adds 47829b9 cops: try to avoid uninitialized warning error
Summary of changes:
epan/dissectors/packet-cops.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)