[asterisk-commits] simon.perreault: branch group/v6 r84817 - /team/group/v6/trunk/main/netsock.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Oct 5 13:14:33 CDT 2007


Author: simon.perreault
Date: Fri Oct  5 13:14:33 2007
New Revision: 84817

URL: http://svn.digium.com/view/asterisk?view=rev&rev=84817
Log:
Fixed FD leak.

Modified:
    team/group/v6/trunk/main/netsock.c

Modified: team/group/v6/trunk/main/netsock.c
URL: http://svn.digium.com/view/asterisk/team/group/v6/trunk/main/netsock.c?view=diff&rev=84817&r1=84816&r2=84817
==============================================================================
--- team/group/v6/trunk/main/netsock.c (original)
+++ team/group/v6/trunk/main/netsock.c Fri Oct  5 13:14:33 2007
@@ -1051,13 +1051,11 @@
 		if (sockfd < 0)
 			continue;
 		if (connect(sockfd, res->ai_addr, res->ai_addrlen) < 0) {
-			close(sockfd);
 			sockfd = -1;
-			continue;
 		}
-		
-		/* If we reach this point, we found an address */
-		break;
+		close(sockfd);
+		if (sockfd >= 0)
+			break;  /* we found a good address */
 	}
 	
 	if (sockfd < 0) {




More information about the asterisk-commits mailing list