diff svr-tcpfwd.c @ 403:75940fef22dd

Fix free() of null pointer found by Klocwork
author Matt Johnston <matt@ucc.asn.au>
date Sat, 03 Feb 2007 09:42:22 +0000
parents 7ce577234a10
children b895f91c2ee6
line wrap: on
line diff
--- a/svr-tcpfwd.c	Thu Nov 02 16:52:59 2006 +0000
+++ b/svr-tcpfwd.c	Sat Feb 03 09:42:22 2007 +0000
@@ -216,8 +216,10 @@
 	if (ret == DROPBEAR_FAILURE) {
 		/* we only free it if a listener wasn't created, since the listener
 		 * has to remember it if it's to be cancelled */
-		m_free(tcpinfo->listenaddr);
-		m_free(tcpinfo);
+		if (tcpinfo) {
+			m_free(tcpinfo->listenaddr);
+			m_free(tcpinfo);
+		}
 	}
 	TRACE(("leave remotetcpreq"))
 	return ret;