[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] bind: fix leak in ssh_bind_accept error path


Hi,

Attached is a patch which should fix a potential memory leak in
'ssh_bind_accept'.  Please let me know if there is a better way
to format the patch.


-Jon
From 707c9a40ba0f615f2625882f0e51cfd620bc0d95 Mon Sep 17 00:00:00 2001
From: Jon Simons <jon@xxxxxxxxxxxxx>
Date: Wed, 23 Oct 2013 12:25:28 -0700
Subject: [PATCH] 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.
---
 src/bind.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/bind.c b/src/bind.c
index e4c9327..8132e3e 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;
 }
-- 
1.8.4.21.g992c386


Follow-Ups:
Re: [PATCH] bind: fix leak in ssh_bind_accept error pathAndreas Schneider <asn@xxxxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org