mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 20:20:07 +00:00
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
This commit is contained in:
2
acl.c
2
acl.c
@@ -259,11 +259,13 @@ int ast_ouraddrfor(struct in_addr *them, struct in_addr *us)
|
|||||||
sin.sin_addr = *them;
|
sin.sin_addr = *them;
|
||||||
if (connect(s, (struct sockaddr *)&sin, sizeof(sin))) {
|
if (connect(s, (struct sockaddr *)&sin, sizeof(sin))) {
|
||||||
ast_log(LOG_WARNING, "Cannot connect\n");
|
ast_log(LOG_WARNING, "Cannot connect\n");
|
||||||
|
close(s);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
slen = sizeof(sin);
|
slen = sizeof(sin);
|
||||||
if (getsockname(s, (struct sockaddr *)&sin, &slen)) {
|
if (getsockname(s, (struct sockaddr *)&sin, &slen)) {
|
||||||
ast_log(LOG_WARNING, "Cannot get socket name\n");
|
ast_log(LOG_WARNING, "Cannot get socket name\n");
|
||||||
|
close(s);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
close(s);
|
close(s);
|
||||||
|
Reference in New Issue
Block a user