aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Simons <jon@jonsimons.org>2013-10-23 12:25:28 -0700
committerAndreas Schneider <asn@cryptomilk.org>2013-10-24 10:37:59 +0200
commit54f89af6d3fea2614aaf191de0837e6bccebcc3a (patch)
treeb465a2bb7c56e9f1c62d8fcf45ea24a6cd1615b6
parent0e4a1b1f66402aadc19abae575209ee56224b224 (diff)
downloadlibssh-54f89af6d3fea2614aaf191de0837e6bccebcc3a.tar.gz
libssh-54f89af6d3fea2614aaf191de0837e6bccebcc3a.tar.xz
libssh-54f89af6d3fea2614aaf191de0837e6bccebcc3a.zip
bind: fix leak in ssh_bind_accept error path
Use 'ssh_socket_free' to cleanup if 'ssh_bind_accept_fd' fails, to be sure to free the ssh_socket in/out buffers.
-rw-r--r--src/bind.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/bind.c b/src/bind.c
index e4c9327e..8132e3e9 100644
--- a/src/bind.c
+++ b/src/bind.c
@@ -454,8 +454,7 @@ int ssh_bind_accept(ssh_bind sshbind, ssh_session session) {
#else
close(fd);
#endif
- if (session->socket)
- ssh_socket_close(session->socket);
+ ssh_socket_free(session->socket);
}
return rc;
}