[cvslog] (2005-08-28 01:39:58 UTC) Module eggdrop1.9: Change committed!

cvslog cvs at tsss.org
Sat Aug 27 19:39:58 CST 2005


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.9
Commit time: 2005-08-28 01:39:58 UTC
Commited by: Bryan Drewery <lordares at shatow.net>

Modified files:
     lib/eggdrop/socket.c

Log message:

* Fixed 2 socket leaks in socket_create()

---------------------- diff included ----------------------
Index: eggdrop1.9/lib/eggdrop/socket.c
diff -u eggdrop1.9/lib/eggdrop/socket.c:1.7 eggdrop1.9/lib/eggdrop/socket.c:1.8
--- eggdrop1.9/lib/eggdrop/socket.c:1.7	Sun Oct 17 00:14:06 2004
+++ eggdrop1.9/lib/eggdrop/socket.c	Sat Aug 27 20:39:48 2005
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: socket.c,v 1.7 2004/10/17 05:14:06 stdarg Exp $";
+static const char rcsid[] = "$Id: socket.c,v 1.8 2005/08/28 01:39:48 lordares Exp $";
 #endif
 
 #include <eggdrop/eggdrop.h>
@@ -235,13 +235,19 @@
 		int yes = 1;
 
 		setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int));
-		if (bind(sock, &src_name.u.addr, src_name.len) != 0) return(-3);
+		if (bind(sock, &src_name.u.addr, src_name.len) != 0) {
+			close(sock);
+			return(-3);
+		}
 		if (flags & SOCKET_SERVER) listen(sock, 50);
 	}
 
 	if (flags & SOCKET_CLIENT) {
 		if (connect(sock, &dest_name.u.addr, dest_name.len) != 0) {
-			if (errno != EINPROGRESS) return(-4);
+			if (errno != EINPROGRESS) {
+				close(sock);
+				return(-4);
+			}
 		}
 	}
 
----------------------- End of diff -----------------------



More information about the Changes mailing list