diff cli-runopts.c @ 407:ea0929224294

Fix another leak found by Klocwork
author Matt Johnston <matt@ucc.asn.au>
date Sat, 03 Feb 2007 13:50:47 +0000
parents 306499676384
children b895f91c2ee6 253958302381
line wrap: on
line diff
--- a/cli-runopts.c	Sat Feb 03 13:31:01 2007 +0000
+++ b/cli-runopts.c	Sat Feb 03 13:50:47 2007 +0000
@@ -358,8 +358,7 @@
 		TRACE(("connectaddr == NULL"))
 		goto fail;
 	}
-
-	connectaddr[0] = '\0';
+	*connectaddr = '\0';
 	connectaddr++;
 
 	connectport = strchr(connectaddr, ':');
@@ -367,8 +366,7 @@
 		TRACE(("connectport == NULL"))
 		goto fail;
 	}
-
-	connectport[0] = '\0';
+	*connectport = '\0';
 	connectport++;
 
 	newfwd = (struct TCPFwdList*)m_malloc(sizeof(struct TCPFwdList));
@@ -402,6 +400,8 @@
 	newfwd->next = *fwdlist;
 	*fwdlist = newfwd;
 
+	m_free(str);
+
 	TRACE(("leave addforward: done"))
 	return;