changeset 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 ae1df0cc3f18
files dbutil.c
diffstat 1 files changed, 1 insertions(+), 0 deletions(-) [+]
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;