Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: jonathan.rajotte-julien@efficios.com (Jonathan Rajotte)
Subject: [lttng-dev] [PATCH lttng-tools] Fix: Close socket handle on error
Date: Fri, 20 Sep 2019 11:34:21 -0400	[thread overview]
Message-ID: <20190920153421.67837-1-jonathan.rajotte-julien@efficios.com> (raw)

Fixes coverity #1399739

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien at efficios.com>
---
 src/bin/lttng-sessiond/client.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

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);
-- 
2.17.1



             reply	other threads:[~2019-09-20 15:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-20 15:34 Jonathan Rajotte [this message]
2019-09-20 21:23 ` Jérémie Galarneau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190920153421.67837-1-jonathan.rajotte-julien@efficios.com \
    --to=jonathan.rajotte-julien@efficios.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox