Fix leak of file descriptors in odd networking situations
authorMark Spencer <markster@digium.com>
Tue, 28 Dec 2004 07:44:13 +0000 (07:44 +0000)
committerMark Spencer <markster@digium.com>
Tue, 28 Dec 2004 07:44:13 +0000 (07:44 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4564 65c4cc65-6c06-0410-ace0-fbb531ad65f3

acl.c

diff --git a/acl.c b/acl.c
index b2c619f..f4daaab 100755 (executable)
--- 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);