aboutsummaryrefslogtreecommitdiffstats
path: root/split-index.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-12-04 10:14:38 +0900
committerJunio C Hamano <gitster@pobox.com>2024-12-04 10:14:40 +0900
commita5dd262a7504fc816d0aad7c7dc7eb73cb0adf82 (patch)
treecac04682f84642083987a06d1c2ae6ebcf8e4a38 /split-index.c
parent2f605347da0f6859175d6110cfd49b2d8937dea4 (diff)
parentfc1ddf42af6742fae7e770cae20e30d7902014c0 (diff)
downloadgit-a5dd262a7504fc816d0aad7c7dc7eb73cb0adf82.tar.gz
Merge branch 'ps/leakfixes-part-10'
Leakfixes. * ps/leakfixes-part-10: (27 commits) t: remove TEST_PASSES_SANITIZE_LEAK annotations test-lib: unconditionally enable leak checking t: remove unneeded !SANITIZE_LEAK prerequisites t: mark some tests as leak free t5601: work around leak sanitizer issue git-compat-util: drop now-unused `UNLEAK()` macro global: drop `UNLEAK()` annotation t/helper: fix leaking commit graph in "read-graph" subcommand builtin/branch: fix leaking sorting options builtin/init-db: fix leaking directory paths builtin/help: fix leaks in `check_git_cmd()` help: fix leaking return value from `help_unknown_cmd()` help: fix leaking `struct cmdnames` help: refactor to not use globals for reading config builtin/sparse-checkout: fix leaking sanitized patterns split-index: fix memory leak in `move_cache_to_base_index()` git: refactor builtin handling to use a `struct strvec` git: refactor alias handling to use a `struct strvec` strvec: introduce new `strvec_splice()` function line-log: fix leak when rewriting commit parents ...
Diffstat (limited to 'split-index.c')
-rw-r--r--split-index.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/split-index.c b/split-index.c
index 120c8190b1..cfbc773e6c 100644
--- a/split-index.c
+++ b/split-index.c
@@ -97,7 +97,11 @@ void move_cache_to_base_index(struct index_state *istate)
mem_pool_combine(istate->ce_mem_pool, istate->split_index->base->ce_mem_pool);
}
- ALLOC_ARRAY(si->base, 1);
+ if (si->base)
+ release_index(si->base);
+ else
+ ALLOC_ARRAY(si->base, 1);
+
index_state_init(si->base, istate->repo);
si->base->version = istate->version;
/* zero timestamp disables racy test in ce_write_index() */