changeset 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 79d48028457c
children e27d7fb23376
files tcp-accept.c
diffstat 1 files changed, 1 insertions(+), 0 deletions(-) [+]
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;
 	}