Skip to content

pr-2330/tetsuo/submit/blame-lifetime-v1

tagged this 26 Nov 03:37
From: =?UTF-8?q?Onur=20G=C3=BCnd=C3=BCz?= <ogunduz@gmail.com>

setup_scoreboard() initializes the file-static suspects slab each
time it runs, but cleanup_scoreboard() doesn't free the slab. A
second setup overwrites the pointer to the previous slab and leaks
its allocations.

Clear the slab during cleanup. Each final blame entry holds a
reference to its origin, so release those references first:
blame_origin_decref() uses the slab to unlink an origin when its
reference count reaches zero.

Add a regression test that sets up and cleans up two scoreboards
in one process. Without the fix, LeakSanitizer reports a leaked
slab; with the fix the test passes for both files and reftable.

Signed-off-by: Onur Gündüz <ogunduz@gmail.com>

Submitted-As: https://lore.kernel.org/git/pull.2330.git.1795664230820.gitgitgadget@gmail.com
Assets 2
Loading