]> git.ipfire.org Git - thirdparty/git.git/commit
split-index: fix memory leak in `move_cache_to_base_index()`
authorPatrick Steinhardt <ps@pks.im>
Wed, 20 Nov 2024 13:39:41 +0000 (14:39 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 20 Nov 2024 23:23:43 +0000 (08:23 +0900)
commita5408d1820e0ea75612bbd6f6a6c495066e5ffcb
tree528402c2a6f110402b1ea4324b07e0d363a473ca
parent1dd7c32daa7d8a4b71d9204f1edbb09a7241e18f
split-index: fix memory leak in `move_cache_to_base_index()`

In `move_cache_to_base_index()` we move the index cache of the main
index into the split index, which is used when writing a shared index.
But we don't release the old split index base in case we already had a
split index before this operation, which can thus leak memory.

Plug the leak by releasing the previous base.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
split-index.c
t/t1700-split-index.sh