midx-write: fix leaking buffer

The buffer used to compute the final MIDX name is never released. Plug
this memory leak.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Patrick Steinhardt 2024-09-30 11:14:01 +02:00 committed by Junio C Hamano
parent 7f97266ee1
commit 9d4855eef3
2 changed files with 4 additions and 0 deletions

View File

@ -1445,6 +1445,8 @@ static int write_midx_internal(const char *object_dir,
return -1;
}

strbuf_release(&final_midx_name);

keep_hashes[ctx.num_multi_pack_indexes_before] =
xstrdup(hash_to_hex(midx_hash));


View File

@ -1,6 +1,8 @@
#!/bin/sh

test_description='incremental multi-pack-index'

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-midx.sh