All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Kacur <jkacur@redhat.com>
To: linux-trace-devel@vger.kernel.org
Cc: Clark Williams <williams@redhat.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	John Kacur <jkacur@redhat.com>
Subject: [PATCH] trace-cmd-listen: Fix resource leak of msg_handle
Date: Fri,  3 May 2019 16:24:49 +0200	[thread overview]
Message-ID: <20190503142449.9936-1-jkacur@redhat.com> (raw)

Fix the potential resource leak of msg_handle by calling
tracecmd_msg_handle_close before returning in an error path

Signed-off-by: John Kacur <jkacur@redhat.com>
---
 tracecmd/trace-listen.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tracecmd/trace-listen.c b/tracecmd/trace-listen.c
index 8bd7badb50e1..3106022eeb39 100644
--- a/tracecmd/trace-listen.c
+++ b/tracecmd/trace-listen.c
@@ -761,6 +761,7 @@ static int do_connection(int cfd, struct sockaddr_storage *peer_addr,
 		plog("Error with getnameinfo: %s\n",
 		       gai_strerror(s));
 		close(cfd);
+		tracecmd_msg_handle_close(msg_handle);
 		return -1;
 	}
 
-- 
2.20.1


             reply	other threads:[~2019-05-03 14:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-03 14:24 John Kacur [this message]
2019-05-03 16:17 ` [PATCH] trace-cmd-listen: Fix resource leak of msg_handle Steven Rostedt

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=20190503142449.9936-1-jkacur@redhat.com \
    --to=jkacur@redhat.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=williams@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.