Mailing List Archive

[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@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
Re: [PATCH] mux: fix memory leak of control path if bind() fails [ In reply to ]
Bert Wesarg <bert.wesarg@googlemail.com> 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@des.no
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
Re: [PATCH] mux: fix memory leak of control path if bind() fails [ In reply to ]
2012/4/27 Dag-Erling Smørgrav <des@des.no>:
> Bert Wesarg <bert.wesarg@googlemail.com> 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@des.no
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev