Fix: lttng-ctl: tracing_group memory leaks
[lttng-tools.git] / src / lib / lttng-ctl / lttng-ctl.c
index 7ad1fe13291b8f40599ad60ce197bbbfc5c6dae5..bb30feff625c49f3c70153583d2937ec881a5643 100644 (file)
@@ -2618,14 +2618,19 @@ end:
  */
 int lttng_set_tracing_group(const char *name)
 {
+       char *new_group;
        if (name == NULL) {
                return -LTTNG_ERR_INVALID;
        }
 
-       if (asprintf(&tracing_group, "%s", name) < 0) {
+       if (asprintf(&new_group, "%s", name) < 0) {
                return -LTTNG_ERR_FATAL;
        }
 
+       free(tracing_group);
+       tracing_group = new_group;
+       new_group = NULL;
+
        return 0;
 }
 
This page took 0.023134 seconds and 4 git commands to generate.