Improve error handling of lttng cli
[lttng-tools.git] / src / bin / lttng / commands / calibrate.c
index a60cadfa042a629eee9d97f1c4c1615a889e6656..dc95d246956739371fec8bf0f7853f8409c5a43a 100644 (file)
@@ -156,7 +156,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 +186,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 +199,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 +223,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 +234,6 @@ int cmd_calibrate(int argc, const char **argv)
        ret = calibrate_lttng();
 
 end:
+       poptFreeContext(pc);
        return ret;
 }
This page took 0.024992 seconds and 4 git commands to generate.