Fix: initialize the cur_event variable before using it
[lttng-tools.git] / src / bin / lttng / commands / list.c
index 0c0a37a7ae74012adf896918a3edc882ae8898eb..e4c029e2951e8ecc01e6256aac71108c46bdbfce 100644 (file)
@@ -493,7 +493,7 @@ static int list_ust_events(void)
        int i, size, ret = CMD_SUCCESS;
        struct lttng_domain domain;
        struct lttng_handle *handle;
-       struct lttng_event *event_list;
+       struct lttng_event *event_list = NULL;
        pid_t cur_pid = 0;
        char *cmdline = NULL;
 
@@ -565,6 +565,8 @@ static int mi_list_ust_event_fields(struct lttng_event_field *fields, int count,
        int event_element_open = 0;
        struct lttng_event cur_event;
 
+       memset(&cur_event, 0, sizeof(cur_event));
+
        /* Open domains element */
        ret = mi_lttng_domains_open(writer);
        if (ret) {
@@ -1855,7 +1857,8 @@ int cmd_list(int argc, const char **argv)
                                        if (ret) {
                                                goto end;
                                        }
-                                       continue;
+
+                                       goto next_domain;
                                }
 
                                switch (domains[i].type) {
@@ -1875,6 +1878,7 @@ int cmd_list(int argc, const char **argv)
                                        goto end;
                                }
 
+next_domain:
                                if (lttng_opt_mi) {
                                        /* Close domain element */
                                        ret = mi_lttng_writer_close_element(writer);
This page took 0.024297 seconds and 4 git commands to generate.