Fix: lttng lttng.c: check strdup OOM
[lttng-tools.git] / src / bin / lttng / lttng.c
index e4a8fd23ca2cfd92639734b0d74ff7b7c819253d..34ccd59c517a6a737f8953cc717f4de28e8f9f60 100644 (file)
@@ -16,6 +16,7 @@
  */
 
 #define _GNU_SOURCE
+#define _LGPL_SOURCE
 #include <getopt.h>
 #include <signal.h>
 #include <stdio.h>
@@ -483,9 +484,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.025355 seconds and 5 git commands to generate.