From 85f22c9f098e853a6c6836d1af8afcee3ea6c4b7 Mon Sep 17 00:00:00 2001 From: Matt Johnston Date: Sat, 3 Feb 2007 09:42:22 +0000 Subject: [PATCH] Fix free() of null pointer found by Klocwork --HG-- extra : convert_revision : 8084d31816a059cc07c6180b6fd5aa86770845cb --- svr-tcpfwd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/svr-tcpfwd.c b/svr-tcpfwd.c index 6391c4c..0151ffe 100644 --- a/svr-tcpfwd.c +++ b/svr-tcpfwd.c @@ -216,8 +216,10 @@ out: 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;