]> git.ipfire.org Git - thirdparty/git.git/commitdiff
repository: avoid leaking `fsmonitor` data
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Fri, 12 Apr 2024 08:49:58 +0000 (10:49 +0200)
committerJohannes Schindelin <johannes.schindelin@gmx.de>
Fri, 12 Apr 2024 09:09:50 +0000 (11:09 +0200)
The `fsmonitor` repo-setting data is allocated lazily. It needs to be
released in `repo_clear()` along the rest of the allocated data in
`repository`.

This is needed because the next commit will merge v2.39.4, which will
add a `git checkout --recurse-modules` call (which would leak memory
without this here fix) to an otherwise leak-free test script.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
repository.c

index 937fa974b38e86a1873a0e6904cd4c35ac5fd8f1..3b943d2cb4222427e7481e12b35fabeca793dc07 100644 (file)
@@ -271,6 +271,8 @@ void repo_clear(struct repository *repo)
        parsed_object_pool_clear(repo->parsed_objects);
        FREE_AND_NULL(repo->parsed_objects);
 
+       FREE_AND_NULL(repo->settings.fsmonitor);
+
        if (repo->config) {
                git_configset_clear(repo->config);
                FREE_AND_NULL(repo->config);