Fix: lttng lttng.c: check strdup OOM
[lttng-tools.git] / src / bin / lttng / lttng.c
index bc7577d77db148d508614e2a3d2929e1bdfeddb1..b9dea18e1952a7c735d529fb8e9da8b9c3f61fd0 100644 (file)
@@ -89,7 +89,7 @@ static struct cmd_struct commands[] =  {
 
 static void usage(FILE *ofp)
 {
-       fprintf(ofp, "LTTng Trace Control " VERSION" - " VERSION_NAME"\n\n");
+       fprintf(ofp, "LTTng Trace Control " FULL_VERSION" - " VERSION_NAME"\n\n");
        fprintf(ofp, "usage: lttng [OPTIONS] <COMMAND> [<ARGS>]\n");
        fprintf(ofp, "\n");
        fprintf(ofp, "Options:\n");
@@ -131,7 +131,7 @@ static void usage(FILE *ofp)
 
 static void version(FILE *ofp)
 {
-       fprintf(ofp, "%s (LTTng Trace Control) " VERSION" - " VERSION_NAME"\n",
+       fprintf(ofp, "%s (LTTng Trace Control) " FULL_VERSION" - " VERSION_NAME"\n",
                        progname);
 }
 
@@ -437,7 +437,10 @@ static int parse_args(int argc, char **argv)
                        ret = 0;
                        goto end;
                case 'v':
-                       lttng_opt_verbose += 1;
+                       /* There is only 3 possible level of verbosity. (-vvv) */
+                       if (lttng_opt_verbose < 3) {
+                               lttng_opt_verbose += 1;
+                       }
                        break;
                case 'q':
                        lttng_opt_quiet = 1;
@@ -450,9 +453,17 @@ static int parse_args(int argc, char **argv)
                        break;
                case OPT_SESSION_PATH:
                        opt_sessiond_path = strdup(optarg);
+                       if (!opt_sessiond_path) {
+                               ret = -1;
+                               goto error;
+                       }
                        break;
                case OPT_RELAYD_PATH:
                        opt_relayd_path = strdup(optarg);
+                       if (!opt_relayd_path) {
+                               ret = -1;
+                               goto error;
+                       }
                        break;
                case OPT_DUMP_OPTIONS:
                        list_options(stdout);
This page took 0.023683 seconds and 4 git commands to generate.