Bert Wesarg
2012-Apr-27 09:29 UTC
[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
Dag-Erling Smørgrav
2012-Apr-27 11:43 UTC
[PATCH] mux: fix memory leak of control path if bind() fails
Bert Wesarg <bert.wesarg at 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 at des.no
Bert Wesarg
2012-Apr-27 11:47 UTC
[PATCH] mux: fix memory leak of control path if bind() fails
2012/4/27 Dag-Erling Sm?rgrav <des at des.no>:> Bert Wesarg <bert.wesarg at 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 at des.no