Skip to content
Snippets Groups Projects
Commit cdbb9183 authored by Mark Spencer's avatar Mark Spencer
Browse files

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
parent 6cd0d316
Branches
Tags
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment