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

[PATCH] http-fetch: do not use curl_message after releasing it

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Nov 6, 2005, 23:59 UTC
Message-ID
<Pine.LNX.4.63.0511070059150.24078@wbgn013.biozentrum.uni-wuerzburg.de>

When curl_message is released using curl_multi_remove_handle(), it's contents are undefined. Therefore, get the information before releasing it.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
 http-fetch.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

applies-to: a216f59923735f7680de8b3d9d333dc14de12b77 0516b1524ce60af57bf056f24b29983a70fb113f

diff --git a/http-fetch.c b/http-fetch.c
index b12779d..ea8af1b 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -578,6 +578,7 @@ void process_curl_messages(void)
 
 	while (curl_message != NULL) {
 		if (curl_message->msg == CURLMSG_DONE) {
+			int curl_result = curl_message->data.result;
 			slot = active_queue_head;
 			while (slot != NULL &&
 			       slot->curl != curl_message->easy_handle)
@@ -587,7 +588,7 @@ void process_curl_messages(void)
 				active_requests--;
 				slot->done = 1;
 				slot->in_use = 0;
-				slot->curl_result = curl_message->data.result;
+				slot->curl_result = curl_result;
 				curl_easy_getinfo(slot->curl,
 						  CURLINFO_HTTP_CODE,
 						  &slot->http_code);
@@ -599,8 +600,7 @@ void process_curl_messages(void)
 				fprintf(stderr, "Received DONE message for unknown request!\n");
 			}
 			if (request != NULL) {
-				request->curl_result =
-					curl_message->data.result;
+				request->curl_result = curl_result;
 				request->http_code = slot->http_code;
 				request->slot = NULL;
 				request->state = COMPLETE;
---
0.99.9.GIT
Message 1 of 1 in “http-fetch: do not use curl_message after releasing it”
  1. http-fetch: do not use curl_message after releasing itJohannes Schindelin, Nov 6, 2005

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.