Fix: Close socket handle on error
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Fri, 20 Sep 2019 15:34:21 +0000 (11:34 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 20 Sep 2019 18:25:09 +0000 (14:25 -0400)
Fixes coverity #1399739

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/client.c

index 956dab8c867413b5cc4e2c79c75cd5e8e1a3bd28..870277534ec2e1f50dc614b1884f73460f984299 100644 (file)
@@ -1985,8 +1985,11 @@ static int create_client_sock(void)
        /* File permission MUST be 660 */
        ret = chmod(config.client_unix_sock_path.value, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
        if (ret < 0) {
-               ERR("Set file permissions failed: %s", config.client_unix_sock_path.value);
+               ERR("Set file permissions failed: %s",
+                               config.client_unix_sock_path.value);
                PERROR("chmod");
+               (void) lttcomm_close_unix_sock(client_sock);
+               ret = -1;
                goto end;
        }
        DBG("Created client socket (fd = %i)", client_sock);
This page took 0.035238 seconds and 4 git commands to generate.