Warning fix: uninitialized variable may be used
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Sat, 14 May 2016 19:30:35 +0000 (15:30 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sat, 14 May 2016 20:33:25 +0000 (16:33 -0400)
GCC warns that discarded_events and lost_packets may be used
uninitialized (NULL).

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/cmd.c

index ba963ffc53c5e15f44ac756ce2842f9767d27ff5..1739aa736f41737dfcd56c183ccca434f890f75f 100644 (file)
@@ -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;
This page took 0.037265 seconds and 4 git commands to generate.