git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2] Fix random crashes in http_cleanup()

From
Mike Hommey <mh@glandium.org>
Date
Mar 3, 2008, 19:30 UTC
Message-ID
<1204572616-25721-1-git-send-email-mh@glandium.org>
In-Reply-To
<20080303100141.15600.qmail@e81d07a86798f7.315fe32.mid.smarden.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>
---
 http.c |   14 +++-----------
 1 files changed, 3 insertions(+), 11 deletions(-)
diff --git a/http.c b/http.c
index 8e554c0..256a5f1 100644
--- a/http.c
+++ b/http.c
@@ -284,23 +284,15 @@ void http_init(struct remote *remote)
 void http_cleanup(void)
 {
 	struct active_request_slot *slot = active_queue_head;
-#ifdef USE_CURL_MULTI
-	char *wait_url;
-#endif
 
 	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
Previous: Gerrit Pape
Message 8 of 8 in “git-http-fetch segfault, curl 7.18.0”
  1. Gerrit PapeMar 2, 2008
  2. Mike HommeyMar 2, 2008
  3. Mike HommeyMar 2, 2008
  4. Daniel BarkalowMar 2, 2008
  5. Mike HommeyMar 2, 2008
  6. Fix random crashes in http_cleanup()Mike Hommey, Mar 2, 2008
  7. Gerrit PapeMar 3, 2008
  8. Fix random crashes in http_cleanup()Mike Hommey, Mar 3, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.