Skip to content

Commit 9699327

Browse files
peffgitster
authored andcommitted
http-push: clean up loose request when falling back to packed
In http-push's finish_request(), if we fail a loose object request we may fall back to trying a packed request. But if we do so, we leave the http_loose_object_request in place, leaking it. We can fix this by always cleaning it up. Note that the obj_req pointer here (which we'll set to NULL) is a copy of the request->userData pointer, which will now point to freed memory. But that's OK. We'll either release the parent request struct entirely, or we'll convert it into a packed request, which will overwrite userData itself. This leak is found by t5540, but it's not quite leak-free yet. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 92e1eb4 commit 9699327

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

http-push.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -582,9 +582,10 @@ static void finish_request(struct transfer_request *request)
582582
if (obj_req->rename == 0)
583583
request->obj->flags |= (LOCAL | REMOTE);
584584

585+
release_http_object_request(&obj_req);
586+
585587
/* Try fetching packed if necessary */
586588
if (request->obj->flags & LOCAL) {
587-
release_http_object_request(&obj_req);
588589
release_request(request);
589590
} else
590591
start_fetch_packed(request);

0 commit comments

Comments
 (0)