mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2025-05-11 21:53:57 +00:00
Fix leaked handle in create_socket (#1554)
Fixes resource leak problem detected by Coverity Scan.
This commit is contained in:
parent
7aba2938d3
commit
c2e156e0e0
@ -2728,7 +2728,10 @@ socket_t create_socket(const std::string &host, const std::string &ip, int port,
|
|||||||
if (sock == INVALID_SOCKET) { continue; }
|
if (sock == INVALID_SOCKET) { continue; }
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
if (fcntl(sock, F_SETFD, FD_CLOEXEC) == -1) { continue; }
|
if (fcntl(sock, F_SETFD, FD_CLOEXEC) == -1) {
|
||||||
|
close_socket(sock);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (tcp_nodelay) {
|
if (tcp_nodelay) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user