diff dbutil.c @ 615:e3ac0a426bd0

Fix FD leak if connect() fails, found by Klocwork
author Matt Johnston <matt@ucc.asn.au>
date Thu, 07 Apr 2011 13:05:10 +0000
parents 00eca37e47e8
children 7cc34a52feb8
line wrap: on
line diff
--- a/dbutil.c	Thu Apr 07 12:59:18 2011 +0000
+++ b/dbutil.c	Thu Apr 07 13:05:10 2011 +0000
@@ -311,6 +311,7 @@
 	}
 	if (connect(fd, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
 		TRACE(("Failed to connect to '%s' socket", path))
+		m_close(fd);
 		return -1;
 	}
 	return fd;