mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2024-12-24 20:01:42 +00:00
segfault on error fix
This commit is contained in:
parent
331038634d
commit
7a74b815fa
@ -570,9 +570,8 @@ int tcp_bind(const char *port, int *family)
|
||||
}
|
||||
}
|
||||
|
||||
if (0 == bind(sockfd, p->ai_addr, p->ai_addrlen))
|
||||
break;
|
||||
|
||||
if (bind(sockfd, p->ai_addr, p->ai_addrlen) < 0)
|
||||
{
|
||||
#if _WIN32
|
||||
wprintf(L"bind() eror: %ld\n", WSAGetLastError());
|
||||
closesocket(sockfd);
|
||||
@ -582,10 +581,15 @@ int tcp_bind(const char *port, int *family)
|
||||
#endif
|
||||
if (p->ai_next != NULL)
|
||||
mprint("trying next addres ...\n");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
*family = p->ai_family;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
freeaddrinfo(ai);
|
||||
|
||||
if (NULL == p)
|
||||
|
Loading…
Reference in New Issue
Block a user