@matheusbsbs / matheus-bagliano / commits / f23d1f7627
Fork 0

Fix random crashes in http_cleanup()

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> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Mike Hommey committed Mar 3, 2008 at 20:30 UTC f23d1f76273a59b030ea1028016e6a9fc9679d2c
1 file changed +3 -11
http.c
+3 -11
@@ -281,23 +281,15 @@ void http_init(void)
281 void http_cleanup(void)
282 {
283 struct active_request_slot *slot = active_queue_head;
284 -#ifdef USE_CURL_MULTI
285 - char *wait_url;
286 -#endif
284
285 while (slot != NULL) {
286 struct active_request_slot *next = slot->next;
287 + if (slot->curl != NULL) {
288 #ifdef USE_CURL_MULTI
291 - if (slot->in_use) {
292 - curl_easy_getinfo(slot->curl,
293 - CURLINFO_EFFECTIVE_URL,
294 - &wait_url);
295 - fprintf(stderr, "Waiting for %s\n", wait_url);
296 - run_active_slot(slot);
297 - }
289 + curl_multi_remove_handle(curlm, slot->curl);
290 #endif
299 - if (slot->curl != NULL)
291 curl_easy_cleanup(slot->curl);
292 + }
293 free(slot);
294 slot = next;
295 }