changeset 371:6aea2cfc113e

Fix memory leak found by Klocwork
author Matt Johnston <matt@ucc.asn.au>
date Thu, 02 Nov 2006 16:45:43 +0000
parents 9a789fc03f40
children fbcc3b5b34f3
files tcp-accept.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/tcp-accept.c	Thu Nov 02 16:10:18 2006 +0000
+++ b/tcp-accept.c	Thu Nov 02 16:45:43 2006 +0000
@@ -126,12 +126,13 @@
 		TRACE(("leave listen_tcpfwd: dropbear_listen failed"))
 		return DROPBEAR_FAILURE;
 	}
-
+	m_free(errstring);
+	
+	/* new_listener will close the socks if it fails */
 	listener = new_listener(socks, nsocks, CHANNEL_ID_TCPFORWARDED, tcpinfo, 
 			tcp_acceptor, cleanup_tcp);
 
 	if (listener == NULL) {
-		m_free(tcpinfo);
 		TRACE(("leave listen_tcpfwd: listener failed"))
 		return DROPBEAR_FAILURE;
 	}