Fix: missing mutex unlock on register consumer err
[lttng-tools.git] / src / bin / lttng-sessiond / main.c
index c0cfddb96166840bfe3effdfe0e7dcf36566a7d6..76d1857004a415701ecb166f8ace70768bc8d472 100644 (file)
@@ -1856,7 +1856,8 @@ static int copy_session_consumer(int domain, struct ltt_session *session)
        }
 
        /* Append correct directory to subdir */
-       strncat(consumer->subdir, dir_name, sizeof(consumer->subdir));
+       strncat(consumer->subdir, dir_name,
+                       sizeof(consumer->subdir) - strlen(consumer->subdir) - 1);
        DBG3("Copy session consumer subdir %s", consumer->subdir);
 
        ret = LTTCOMM_OK;
@@ -2032,6 +2033,7 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int sock,
                pthread_mutex_lock(&kconsumer_data.pid_mutex);
                if (kconsumer_data.pid > 0) {
                        ret = LTTCOMM_KERN_CONSUMER_FAIL;
+                       pthread_mutex_unlock(&kconsumer_data.pid_mutex);
                        goto error;
                }
                pthread_mutex_unlock(&kconsumer_data.pid_mutex);
This page took 0.023694 seconds and 4 git commands to generate.