diff tcp-accept.c @ 478:d4f32c3443ac dbclient-netcat-alike

propagate from branch 'au.asn.ucc.matt.dropbear' (head f21045c791002d81fc6b8dde6537ea481e513eb2) to branch 'au.asn.ucc.matt.dropbear.dbclient-netcat-alike' (head d1f69334581dc4c35f9ca16aa5355074c9dd315d)
author Matt Johnston <matt@ucc.asn.au>
date Sun, 14 Sep 2008 06:47:51 +0000
parents c216212001fc
children 69e98c45db7c
line wrap: on
line diff
--- a/tcp-accept.c	Tue Mar 21 16:16:41 2006 +0000
+++ b/tcp-accept.c	Sun Sep 14 06:47:51 2008 +0000
@@ -104,7 +104,7 @@
 	struct Listener *listener = NULL;
 	int nsocks;
 	char* errstring = NULL;
-	// listen_spec = NULL indicates localhost
+	/* listen_spec = NULL indicates localhost */
 	const char* listen_spec = NULL;
 
 	TRACE(("enter listen_tcpfwd"))
@@ -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;
 	}