From: Mark Spencer Date: Tue, 28 Dec 2004 07:44:13 +0000 (+0000) Subject: Fix leak of file descriptors in odd networking situations X-Git-Tag: 1.2.0-beta1~1572 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cdbb9183d6ba73f03169c17d8a9716e4ce09c3be;p=thirdparty%2Fasterisk.git Fix leak of file descriptors in odd networking situations git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4564 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/acl.c b/acl.c index b2c619f8bb..f4daaab2a1 100755 --- a/acl.c +++ b/acl.c @@ -259,11 +259,13 @@ int ast_ouraddrfor(struct in_addr *them, struct in_addr *us) sin.sin_addr = *them; if (connect(s, (struct sockaddr *)&sin, sizeof(sin))) { ast_log(LOG_WARNING, "Cannot connect\n"); + close(s); return -1; } slen = sizeof(sin); if (getsockname(s, (struct sockaddr *)&sin, &slen)) { ast_log(LOG_WARNING, "Cannot get socket name\n"); + close(s); return -1; } close(s);