Fix: lttng: enable-channel: leak of popt arguments
[lttng-tools.git] / src / bin / lttng / commands / enable_channels.c
index 59fde7d4cec50c7c2486c6951d7edae157024030..9bfce348b9d038148b565cd01d7a9c8f8f809f87 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 David Goulet <david.goulet@polymtl.ca>
+ * Copyright (C) 2011 EfficiOS Inc.
  *
  * SPDX-License-Identifier: GPL-2.0-only
  *
@@ -21,6 +21,8 @@
 #include <common/utils.h>
 #include <common/mi-lttng.h>
 
+#include <lttng/domain-internal.h>
+
 #include "../command.h"
 #include "../utils.h"
 
@@ -304,7 +306,8 @@ static int enable_channel(char *session_name)
                        }
                } else {
                        MSG("%s channel %s enabled for session %s",
-                                       get_domain_str(dom.type), channel_name, session_name);
+                                       lttng_domain_type_str(dom.type),
+                                       channel_name, session_name);
                        success = 1;
                }
 
@@ -642,9 +645,15 @@ int cmd_enable_channels(int argc, const char **argv)
                        ret = CMD_UNDEFINED;
                        goto end;
                }
+
+               if (opt_arg) {
+                       free(opt_arg);
+                       opt_arg = NULL;
+               }
        }
 
-       ret = print_missing_or_multiple_domains(opt_kernel + opt_userspace);
+       ret = print_missing_or_multiple_domains(
+                       opt_kernel + opt_userspace, false);
        if (ret) {
                ret = CMD_ERROR;
                goto end;
@@ -752,5 +761,6 @@ end:
        /* Overwrite ret if an error occurred when enable_channel */
        ret = command_ret ? command_ret : ret;
        poptFreeContext(pc);
+       free(opt_arg);
        return ret;
 }
This page took 0.024038 seconds and 4 git commands to generate.