Repository navigation
pr-2331/tetsuo/submit/refs-debug-lifetime-v1
tagged this
26 Nov 03:37
From: =?UTF-8?q?Onur=20G=C3=BCnd=C3=BCz?= <ogunduz@gmail.com> The debug ref store owns both the wrapped store and a copy of its backend descriptor. However, debug_release() only invokes the wrapped backend's release callback. This leaves the wrapped store, its gitdir and the copied descriptor allocated when the debug store is freed. Release the wrapped store through ref_store_release() to free its gitdir as well as its backend-specific resources, then free the store itself. Embed the copied backend descriptor in the debug store so that it shares the wrapper's lifetime. Add a test helper that reads HEAD through a repository's main ref store and then clears the repository. Exercise it with tracing on and off. With GIT_TRACE_REFS=1, the test fails under LeakSanitizer without this fix for both the files and reftable backends. Signed-off-by: Onur Gündüz <ogunduz@gmail.com> Submitted-As: https://lore.kernel.org/git/pull.2331.git.1795664279088.gitgitgadget@gmail.com