Initialize all stack variables to zero, fix uninitialized loglevel variables
[lttng-tools.git] / src / bin / lttng / commands / calibrate.c
index a60cadfa042a629eee9d97f1c4c1615a889e6656..61b588e1294eead110e14bb5e043f0d74318b065 100644 (file)
@@ -127,6 +127,9 @@ static int calibrate_lttng(void)
        struct lttng_domain dom;
        struct lttng_calibrate calibrate;
 
+       memset(&dom, 0, sizeof(dom));
+       memset(&calibrate, 0, sizeof(calibrate));
+
        /* Create lttng domain */
        if (opt_kernel) {
                dom.type = LTTNG_DOMAIN_KERNEL;
@@ -156,7 +159,6 @@ static int calibrate_lttng(void)
                calibrate.type = LTTNG_CALIBRATE_FUNCTION;
                ret = lttng_calibrate(handle, &calibrate);
                if (ret < 0) {
-                       ret = CMD_ERROR;
                        goto error;
                }
                MSG("%s calibration done", opt_kernel ? "Kernel" : "UST");
@@ -187,7 +189,7 @@ error:
  */
 int cmd_calibrate(int argc, const char **argv)
 {
-       int opt, ret;
+       int opt, ret = CMD_SUCCESS;
        static poptContext pc;
 
        pc = poptGetContext(NULL, argc, argv, long_options, 0);
@@ -200,7 +202,6 @@ int cmd_calibrate(int argc, const char **argv)
                switch (opt) {
                case OPT_HELP:
                        usage(stdout);
-                       ret = CMD_SUCCESS;
                        goto end;
                case OPT_TRACEPOINT:
                        ret = CMD_UNDEFINED;
@@ -225,7 +226,6 @@ int cmd_calibrate(int argc, const char **argv)
                        break;
                case OPT_LIST_OPTIONS:
                        list_cmd_options(stdout, long_options);
-                       ret = CMD_SUCCESS;
                        goto end;
                default:
                        usage(stderr);
@@ -237,5 +237,6 @@ int cmd_calibrate(int argc, const char **argv)
        ret = calibrate_lttng();
 
 end:
+       poptFreeContext(pc);
        return ret;
 }
This page took 0.023813 seconds and 4 git commands to generate.