[PATCH v2 01/10] repository: fix repo_init() memleak due to missing _clear()
- From
Adrian Ratiu <adrian.ratiu@collabora.com>
- Date
- Feb 22, 2026, 00:28 UTC
- Message-ID
- <20260222002904.1879356-2-adrian.ratiu@collabora.com>
- In-Reply-To
- <20260222002904.1879356-1-adrian.ratiu@collabora.com>
There is an old pre-existing memory leak in repo_init() due to failing to call clear_repository_format() in the error case.
It went undetected because a specific bug is required to trigger it: enable a v1 extension in a repository with format v0. Obviously this can only happen in a development environment, so it does not trigger in normal usage, however the memleak is real and needs fixing.
Fix it by also calling clear_repository_format() in the error case.
Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com> --- repository.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/repository.c b/repository.c index f27ab29b0e..78aa2d31d0 100644 --- a/repository.c +++ b/repository.c @@ -298,6 +298,7 @@ int repo_init(struct repository *repo, return 0; error: + clear_repository_format(&format); repo_clear(repo); return -1; }
-- 2.52.0.732.gb351b5166d.dirty