diff tcp-accept.c @ 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 3cea9d789cca
children a124aff0cbf1
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;
 	}