Skip to content

Commit 4b9fa0e

Browse files
rctaygitster
authored andcommitted
http.c: set slot callback members to NULL when releasing object
Set the members callback_func and callback_data of freq->slot to NULL when releasing a http_object_request. release_active_slot() is also invoked on the slot to remove the curl handle associated with the slot from the multi stack (CURLM *curlm in http.c). These prevent the callback function and data from being used in http methods (like http.c::finish_active_slot()) after a http_object_request has been free'd. Noticed by Ali Polatel, who later tested this patch to verify that it fixes the problem he saw; Dscho helped to identify the problem spot. Signed-off-by: Tay Ray Chuan <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 749086f commit 4b9fa0e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

http.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1285,5 +1285,10 @@ void release_http_object_request(struct http_object_request *freq)
12851285
free(freq->url);
12861286
freq->url = NULL;
12871287
}
1288-
freq->slot = NULL;
1288+
if (freq->slot != NULL) {
1289+
freq->slot->callback_func = NULL;
1290+
freq->slot->callback_data = NULL;
1291+
release_active_slot(freq->slot);
1292+
freq->slot = NULL;
1293+
}
12891294
}

0 commit comments

Comments
 (0)