linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] trace-cmd-listen: Fix resource leak of msg_handle
@ 2019-05-03 14:24 John Kacur
  2019-05-03 16:17 ` Steven Rostedt
  0 siblings, 1 reply; 2+ messages in thread
From: John Kacur @ 2019-05-03 14:24 UTC (permalink / raw)
  To: linux-trace-devel; +Cc: Clark Williams, Steven Rostedt, John Kacur

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] trace-cmd-listen: Fix resource leak of msg_handle
  2019-05-03 14:24 [PATCH] trace-cmd-listen: Fix resource leak of msg_handle John Kacur
@ 2019-05-03 16:17 ` Steven Rostedt
  0 siblings, 0 replies; 2+ messages in thread
From: Steven Rostedt @ 2019-05-03 16:17 UTC (permalink / raw)
  To: John Kacur; +Cc: linux-trace-devel, Clark Williams

On Fri,  3 May 2019 16:24:49 +0200
John Kacur <jkacur@redhat.com> wrote:

> 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;
>  	}
>  

Applied. Thanks John!

-- Steve

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-05-03 16:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-03 14:24 [PATCH] trace-cmd-listen: Fix resource leak of msg_handle John Kacur
2019-05-03 16:17 ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).