From: Jonathan Rajotte Date: Fri, 20 Sep 2019 15:34:21 +0000 (-0400) Subject: Fix: Close socket handle on error X-Git-Tag: v2.11.0-rc4~16 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=4fd2806f2d222f31bb7df9d51353ba48dae43618;p=lttng-tools.git Fix: Close socket handle on error Fixes coverity #1399739 Signed-off-by: Jonathan Rajotte Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-sessiond/client.c b/src/bin/lttng-sessiond/client.c index 956dab8c8..870277534 100644 --- a/src/bin/lttng-sessiond/client.c +++ b/src/bin/lttng-sessiond/client.c @@ -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);