Fix: zero out data structure before using it
[lttng-tools.git] / src / bin / lttng-sessiond / cmd.c
index 4343fb114191352dbdaf13ee7a928fc283119c08..73ba7740fd131863172c53ae9e1cb558fe09f323 100644 (file)
@@ -1439,6 +1439,7 @@ int cmd_enable_event(struct ltt_session *session, struct lttng_domain *domain,
                assert(usess);
 
                /* Create the default JUL tracepoint. */
+               memset(&uevent, 0, sizeof(uevent));
                uevent.type = LTTNG_EVENT_TRACEPOINT;
                uevent.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
                strncpy(uevent.name, DEFAULT_JUL_EVENT_NAME, sizeof(uevent.name));
@@ -2846,12 +2847,17 @@ static int record_ust_snapshot(struct ltt_ust_session *usess,
 
        ret = ust_app_snapshot_record(usess, output, wait, nb_streams);
        if (ret < 0) {
-               if (ret == -EINVAL) {
+               switch (-ret) {
+               case EINVAL:
                        ret = LTTNG_ERR_INVALID;
-                       goto error_snapshot;
+                       break;
+               case ENODATA:
+                       ret = LTTNG_ERR_SNAPSHOT_NODATA;
+                       break;
+               default:
+                       ret = LTTNG_ERR_SNAPSHOT_FAIL;
+                       break;
                }
-
-               ret = LTTNG_ERR_SNAPSHOT_FAIL;
                goto error_snapshot;
        }
 
This page took 0.024244 seconds and 5 git commands to generate.