diff tcp-accept.c @ 621:d2daeb015138

Clean up leaked FD if getnameinfo fails. From Klocwork
author Matt Johnston <matt@ucc.asn.au>
date Thu, 07 Apr 2011 13:52:43 +0000
parents 69e98c45db7c
children abf040aedd44
line wrap: on
line diff
--- a/tcp-accept.c	Thu Apr 07 13:39:10 2011 +0000
+++ b/tcp-accept.c	Thu Apr 07 13:52:43 2011 +0000
@@ -61,6 +61,7 @@
 	if (getnameinfo((struct sockaddr*)&addr, len, ipstring, sizeof(ipstring),
 				portstring, sizeof(portstring), 
 				NI_NUMERICHOST | NI_NUMERICSERV) != 0) {
+		m_close(fd);
 		return;
 	}