]> git.99rst.org Git - git.git/commit
http: fix memory leak in fetch_and_setup_pack_index()
authorLorenzoPegorari <redacted>
Mon, 1 Jun 2026 13:52:12 +0000 (15:52 +0200)
committerJunio C Hamano <redacted>
Mon, 1 Jun 2026 22:57:52 +0000 (07:57 +0900)
commit18decad922884a69ea39c0332f7a94ce82cf99cc
treeba9cc24561ad33fdcd89ea13d8da6226dead9659
parent96ee7f1650e6096561599f069d18c052412d7506
http: fix memory leak in fetch_and_setup_pack_index()

Inside the function `fetch_and_setup_pack_index()`, when the pack
obtained using `parse_pack_index()` fails to be verified by
`verify_pack_index()`, the function returns without closing and freeing
said pack.

Fix this by calling `close_pack_index()` to munmap the index file for
the leaking pack (which might have been mmapped by `fetch_pack_index()`
or `verify_pack_index()`), and then free it, when the verification
fails.

Signed-off-by: LorenzoPegorari <redacted>
Signed-off-by: Junio C Hamano <redacted>
http.c
git clone https://git.99rst.org/PROJECT