Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: OpenSSH: Dev

[PATCH] mux: fix memory leak of control path if bind() fails

 

 

OpenSSH dev RSS feed   Index | Next | Previous | View Threaded


bert.wesarg at googlemail

Apr 27, 2012, 2:29 AM

Post #1 of 3 (331 views)
Permalink
[PATCH] mux: fix memory leak of control path if bind() fails

---
mux.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mux.c b/mux.c
index d90605e..fa796bd 100644
--- a/mux.c
+++ b/mux.c
@@ -1195,6 +1195,7 @@ muxserver_listen(void)
close(muxserver_sock);
muxserver_sock = -1;
}
+ xfree(orig_control_path);
xfree(options.control_path);
options.control_path = NULL;
options.control_master = SSHCTL_MASTER_NO;
@@ -1216,7 +1217,6 @@ muxserver_listen(void)
}
error("ControlSocket %s already exists, disabling multiplexing",
orig_control_path);
- xfree(orig_control_path);
unlink(options.control_path);
goto disable_mux_master;
}
--
1.7.9.rc0.542.g07ca1

_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev [at] mindrot
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev


des at des

Apr 27, 2012, 4:43 AM

Post #2 of 3 (302 views)
Permalink
Re: [PATCH] mux: fix memory leak of control path if bind() fails [In reply to]

Bert Wesarg <bert.wesarg [at] googlemail> writes:
> + xfree(orig_control_path);

so you want to free the buffer

> error("ControlSocket %s already exists, disabling multiplexing",
> orig_control_path);

about 20 lines before passing it to a printf() equivalent?

DES
--
Dag-Erling Smørgrav - des [at] des
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev [at] mindrot
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev


bert.wesarg at googlemail

Apr 27, 2012, 4:47 AM

Post #3 of 3 (301 views)
Permalink
Re: [PATCH] mux: fix memory leak of control path if bind() fails [In reply to]

2012/4/27 Dag-Erling Smørgrav <des [at] des>:
> Bert Wesarg <bert.wesarg [at] googlemail> writes:
>> +                     xfree(orig_control_path);
>
> so you want to free the buffer
>
>>               error("ControlSocket %s already exists, disabling multiplexing",
>>                   orig_control_path);
>
> about 20 lines before passing it to a printf() equivalent?

Luckily there is a return only 4 lines after the free.

Bert

>
> DES
> --
> Dag-Erling Smørgrav - des [at] des
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev [at] mindrot
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev

OpenSSH dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.