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>
Patrick Steinhardt committed
Sep 30, 2024 at 11:14 UTC
9d4855eef3644ac00d62e08d797ff7db554ca65d
2 files changed
+4
midx-write.c
+2
@@ -1445,6 +1445,8 @@ static int write_midx_internal(const char *object_dir,
1445
return -1;
1446
}
1447
1448
+ strbuf_release(&final_midx_name);
1449
+
1450
keep_hashes[ctx.num_multi_pack_indexes_before] =
1451
xstrdup(hash_to_hex(midx_hash));
1452
t/t5334-incremental-multi-pack-index.sh
+2
@@ -1,6 +1,8 @@
1
#!/bin/sh
2
3
test_description='incremental multi-pack-index'
4
+
5
+TEST_PASSES_SANITIZE_LEAK=true
6
. ./test-lib.sh
7
. "$TEST_DIRECTORY"/lib-midx.sh
8