[PATCH] Fix random crashes in http_cleanup()
- From
Mike Hommey <mh@glandium.org>
- Date
- Mar 2, 2008, 20:28 UTC
- Message-ID
- <1204489713-8696-1-git-send-email-mh@glandium.org>
- In-Reply-To
- <20080302200309.GA2070@glandium.org>
For some reason, http_cleanup was running all active slots, which could lead in situations where a freed slot would be accessed in fill_active_slots. OTOH, we are cleaning up, which means the caller doesn't care about pending requests. Just forget about them instead or running them.
Signed-off-by: Mike Hommey <mh@glandium.org> --- > Now, why do we need to run slots when cleaning up ?
I just think we don't care, so this fix should be okay.
http.c | 11 +++-------- 1 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/http.c b/http.c index 5925d07..9683e46 100644 --- a/http.c +++ b/http.c @@ -287,17 +287,12 @@ void http_cleanup(void) while (slot != NULL) { struct active_request_slot *next = slot->next; + if (slot->curl != NULL) { #ifdef USE_CURL_MULTI - if (slot->in_use) { - curl_easy_getinfo(slot->curl, - CURLINFO_EFFECTIVE_URL, - &wait_url); - fprintf(stderr, "Waiting for %s\n", wait_url); - run_active_slot(slot); - } + curl_multi_remove_handle(curlm, slot->curl); #endif - if (slot->curl != NULL) curl_easy_cleanup(slot->curl); + } free(slot); slot = next; }
-- 1.5.4.3.368.g272aa.dirty