gcc 7.2 warns of potentially uninitialized variables being
used as the callers rely on output parameters being
initialized by the callees on error. This behaviour is not
specified as part of the API so relying on this is iffy.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
assert(element_count >= 0);
for (i = 0; i < element_count; i++) {
- struct bt_field_type *field;
+ struct bt_field_type *field = NULL;
int field_alignment;
ret = bt_field_type_structure_get_field_by_index(
_SET(set, _EVENT_NAME_SET);
} else if (!strcmp(left, "id")) {
- int64_t id;
+ int64_t id = -1;
if (_IS_SET(set, _EVENT_ID_SET)) {
_BT_LOGE_DUP_ATTR(node, "id",
g_free(right);
_SET(set, _CLOCK_DESCRIPTION_SET);
} else if (!strcmp(left, "freq")) {
- uint64_t freq;
+ uint64_t freq = -1ULL;
if (_IS_SET(set, _CLOCK_FREQ_SET)) {
_BT_LOGE_DUP_ATTR(entry_node, "freq", "clock class");