aboutsummaryrefslogtreecommitdiff
path: root/src/IO/http.c
diff options
context:
space:
mode:
authorcorvid <devnull@localhost>2014-09-06 16:56:22 +0000
committercorvid <devnull@localhost>2014-09-06 16:56:22 +0000
commitfba15c573ff8cef520ec7bc4214d144757304497 (patch)
treee60b2c3b68117b56b31d42c7965cd864e6fa1bd2 /src/IO/http.c
parentf4071f542daed6136c66beb68251de7d89a0d4de (diff)
http fd map robustness
Diffstat (limited to 'src/IO/http.c')
-rw-r--r--src/IO/http.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/IO/http.c b/src/IO/http.c
index c95f7151..f85e23ff 100644
--- a/src/IO/http.c
+++ b/src/IO/http.c
@@ -158,6 +158,7 @@ void a_Http_set_proxy_passwd(const char *str)
static int Http_sock_new(void)
{
SocketData_t *S = dNew0(SocketData_t, 1);
+ S->SockFD = -1;
return a_Klist_insert(&ValidSocks, S);
}
@@ -233,6 +234,8 @@ static void Http_socket_free(int SKey)
if (S->flags & HTTP_SOCKET_QUEUED) {
S->flags |= HTTP_SOCKET_TO_BE_FREED;
} else {
+ if (S->SockFD != -1)
+ Http_fd_map_remove_entry(S->SockFD);
if (S->connected_to) {
HostConnection_t *hc = Http_host_connection_get(S->connected_to);
hc->active_conns--;
@@ -240,7 +243,6 @@ static void Http_socket_free(int SKey)
if (hc->active_conns == 0)
Http_host_connection_remove(hc);
}
- Http_fd_map_remove_entry(S->SockFD);
dFree(S);
}
}