git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Hommey <mh@glandium.org>
To: git@vger.kernel.org, gitster@pobox.com
Cc: Daniel Barkalow <barkalow@iabervon.org>
Subject: [PATCH v2] Fix random crashes in http_cleanup()
Date: Mon,  3 Mar 2008 20:30:16 +0100	[thread overview]
Message-ID: <1204572616-25721-1-git-send-email-mh@glandium.org> (raw)
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


      reply	other threads:[~2008-03-03 19:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-02 19:08 git-http-fetch segfault, curl 7.18.0 Gerrit Pape
2008-03-02 19:23 ` Mike Hommey
2008-03-02 20:03   ` Mike Hommey
2008-03-02 20:20     ` Daniel Barkalow
2008-03-02 20:33       ` Mike Hommey
2008-03-02 20:28     ` [PATCH] Fix random crashes in http_cleanup() Mike Hommey
2008-03-03 10:01       ` Gerrit Pape
2008-03-03 19:30         ` Mike Hommey [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1204572616-25721-1-git-send-email-mh@glandium.org \
    --to=mh@glandium.org \
    --cc=barkalow@iabervon.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).