Fix: lttng: initialize variable in run_command_string
[lttng-tools.git] / src / lib / lttng-ctl / lttng-ctl.c
index c304a37dba4b269e8ac8740cdb0de93d521051a1..6c9ecb9baf6200208ed846fac34319b7f0688001 100644 (file)
@@ -367,7 +367,7 @@ static int set_session_daemon_path(void)
                in_tgroup = lttng_check_tracing_group();
        }
 
-       if ((uid == 0) || in_tgroup) {
+       if ((uid == 0) || in_tgroup == 1) {
                const int ret = lttng_strncpy(sessiond_sock_path,
                                DEFAULT_GLOBAL_CLIENT_UNIX_SOCK,
                                sizeof(sessiond_sock_path));
@@ -2525,14 +2525,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.02363 seconds and 4 git commands to generate.