diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2010-02-02 23:42:19 +0100 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2010-02-02 23:42:19 +0100 |
commit | 16496947b1be52ab71f293558c615c44667615d0 (patch) | |
tree | 010ea2e02265acd77a6e65fc7eae97969f8a91c7 /src/IO/http.c | |
parent | 8cb9f8f9b4bb60f1c229857ceb9c4290724c0fcb (diff) |
fix HostConnection_t leak
Found by Jeremy's automatic valgrind logs, pointed out by corvid.
Diffstat (limited to 'src/IO/http.c')
-rw-r--r-- | src/IO/http.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/IO/http.c b/src/IO/http.c index 940f3163..8518a392 100644 --- a/src/IO/http.c +++ b/src/IO/http.c @@ -729,18 +729,17 @@ static HostConnection_t *Http_host_connection_get(const char *host) static void Http_host_connection_remove(HostConnection_t *hc) { assert(hc->queue.head == NULL); - dFree(hc->host); dList_remove_fast(host_connections, hc); + dFree(hc->host); + dFree(hc); } static void Http_host_connection_remove_all() { - int i; HostConnection_t *hc; - for (i = 0; i < dList_length(host_connections); i++) { - hc = (HostConnection_t*) dList_nth_data(host_connections, i); - + while (dList_length(host_connections) > 0) { + hc = (HostConnection_t*) dList_nth_data(host_connections, 0); while (Http_socket_dequeue(&hc->queue)); Http_host_connection_remove(hc); } |