git » nmdb » commit a8c71c8

Add two missing close() in an error path.

author Alberto Bertogli
2007-08-25 22:49:47 UTC
committer Alberto Bertogli
2007-08-25 22:49:47 UTC
parent d36c4cb7e821f10298932268c74994c42bb0ce82

Add two missing close() in an error path.

They're not really required, but they dont hurt either.

Signed-off-by: Alberto Bertogli <albertito@gmail.com>

nmdb/tipc.c +3 -1
nmdb/udp.c +3 -1

diff --git a/nmdb/tipc.c b/nmdb/tipc.c
index 3862106..8cf340e 100644
--- a/nmdb/tipc.c
+++ b/nmdb/tipc.c
@@ -175,8 +175,10 @@ int tipc_init(void)
 		return -1;
 
 	rv = bind(fd, (struct sockaddr *) &srvsa, sizeof(srvsa));
-	if (rv < 0)
+	if (rv < 0) {
+		close(fd);
 		return -1;
+	}
 
 	return fd;
 }
diff --git a/nmdb/udp.c b/nmdb/udp.c
index aca8081..50beb9c 100644
--- a/nmdb/udp.c
+++ b/nmdb/udp.c
@@ -180,8 +180,10 @@ int udp_init(void)
 	}
 
 	rv = bind(fd, (struct sockaddr *) &srvsa, sizeof(srvsa));
-	if (rv < 0)
+	if (rv < 0) {
+		close(fd);
 		return -1;
+	}
 
 	return fd;
 }