Commits

Anonymous committed 9027907

http-fetch: do not use curl_message after releasing it

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>
Signed-off-by: Junio C Hamano <junkio@cox.net>

  • Participants
  • Parent commits 67ffdf4

Comments (0)

Files changed (1)

 
 	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)
 				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);
 				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;