X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fview.c;h=cb4b5074361ebbfe62cbbb83e01812353430b613;hb=ffb0b851ac47de854df910d226dfd150b32e8bfe;hp=adedf298966c0c7fad786f13bb34a66f4698a6de;hpb=8960e9cd5adb7e5cdaece135530a457cd65324dc;p=lttng-tools.git diff --git a/src/bin/lttng/commands/view.c b/src/bin/lttng/commands/view.c index adedf2989..cb4b50743 100644 --- a/src/bin/lttng/commands/view.c +++ b/src/bin/lttng/commands/view.c @@ -16,6 +16,7 @@ */ #define _GNU_SOURCE +#define _LGPL_SOURCE #include #include #include @@ -151,7 +152,7 @@ static char **alloc_argv_from_user_opts(char *opts, const char *trace_path) } while (*token != '\0'); /* Add two here for the NULL terminating element and trace path */ - argv = malloc(sizeof(char *) * (num_opts + 2)); + argv = zmalloc(sizeof(char *) * (num_opts + 2)); if (argv == NULL) { goto error; } @@ -159,6 +160,9 @@ static char **alloc_argv_from_user_opts(char *opts, const char *trace_path) token = strtok(opts, " "); while (token != NULL) { argv[i] = strdup(token); + if (argv[i] == NULL) { + goto error; + } token = strtok(NULL, " "); i++; } @@ -198,7 +202,7 @@ static char **alloc_argv_from_local_opts(const char **opts, size_t opts_len, size = sizeof(char *) * mem_len; /* Add two here for the trace_path and the NULL terminating element. */ - argv = malloc(size); + argv = zmalloc(size); if (argv == NULL) { goto error; } @@ -445,6 +449,10 @@ int cmd_view(int argc, const char **argv) pc = poptGetContext(NULL, argc, argv, long_options, 0); poptReadDefaultConfig(pc, 0); + if (lttng_opt_mi) { + WARN("mi does not apply to view command"); + } + while ((opt = poptGetNextOpt(pc)) != -1) { switch (opt) { case OPT_HELP: