From: Jérémie Galarneau Date: Sat, 14 May 2016 19:30:35 +0000 (-0400) Subject: Warning fix: uninitialized variable may be used X-Git-Tag: v2.8.0~128 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=79a0efeb3d41648809785d17339e43b41d9efe26;p=lttng-tools.git Warning fix: uninitialized variable may be used GCC warns that discarded_events and lost_packets may be used uninitialized (NULL). Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index ba963ffc5..1739aa736 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -187,6 +187,11 @@ static int get_ust_runtime_stats(struct ltt_session *session, int ret; struct ltt_ust_session *usess; + if (!discarded_events || !lost_packets) { + ret = -1; + goto end; + } + usess = session->ust_session; assert(discarded_events); assert(lost_packets); @@ -270,7 +275,7 @@ static void list_lttng_channels(enum lttng_domain_type domain, rcu_read_lock(); cds_lfht_for_each_entry(session->ust_session->domain_global.channels->ht, &iter.iter, uchan, node.node) { - uint64_t discarded_events, lost_packets; + uint64_t discarded_events = 0, lost_packets = 0; strncpy(channels[i].name, uchan->name, LTTNG_SYMBOL_NAME_LEN); channels[i].attr.overwrite = uchan->attr.overwrite;