diff mbox series

trace-cmd-listen: Fix resource leak of msg_handle

Message ID 20190503142449.9936-1-jkacur@redhat.com (mailing list archive)
State Accepted
Commit 50b0d604e5fdb414eb0dd155a196c50473e13fc1
Headers show
Series trace-cmd-listen: Fix resource leak of msg_handle | expand

Commit Message

John Kacur May 3, 2019, 2:24 p.m. UTC
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(+)

Comments

Steven Rostedt May 3, 2019, 4:17 p.m. UTC | #1
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
diff mbox series

Patch

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