X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fcreate.cpp;h=64cf2b37ca37f46b70b5e5dc2bb0e699024ed779;hb=e2ecf532ebfc7c4e47b97f1465767568fc0c5aee;hp=b46893d5eff2c3398329bad262c8b7015e9cc720;hpb=21cf9b6b1843774306a76f4dccddddd706b64f79;p=lttng-tools.git diff --git a/src/bin/lttng/commands/create.cpp b/src/bin/lttng/commands/create.cpp index b46893d5e..64cf2b37c 100644 --- a/src/bin/lttng/commands/create.cpp +++ b/src/bin/lttng/commands/create.cpp @@ -14,20 +14,21 @@ #include #include #include -#include +#include #include #include #include -#include +#include -#include "../command.h" -#include "../utils.h" +#include "../command.hpp" +#include "../utils.hpp" -#include -#include -#include -#include +#include +#include +#include +#include +#include #include static char *opt_output_path; @@ -672,6 +673,11 @@ int cmd_create(int argc, const char **argv) uint64_t v; errno = 0; + if (opt_arg) { + free(opt_arg); + opt_arg = nullptr; + } + opt_arg = poptGetOptArg(pc); if (!opt_arg) { /* Set up default values. */ @@ -802,6 +808,7 @@ end: /* Overwrite ret if an error occurred in create_session() */ ret = command_ret ? command_ret : ret; + free(opt_arg); poptFreeContext(pc); return ret; }