mmap-cache: LIST_REMOVE() *after* w->unused_prev
authorVito Caputo <vcaputo@pengaru.com>
Thu, 25 Nov 2021 15:05:06 +0000 (07:05 -0800)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 11 Jan 2022 17:58:24 +0000 (18:58 +0100)
commit42ca0ab5082344004c0f26b2d6ec57b7a9d4ff03
tree341e5441b8a841b9e6b7e6eda34b6ff72e2bfbfe
parent06a0e8283ed87773795f28e58318d5d1b46b1088
mmap-cache: LIST_REMOVE() *after* w->unused_prev

The LIST_REMOVE() macro always assigns NULL to w->unused_prev,
meaning every time this window was in last_unused, the remainder
of the unused list was lost to the ether.

Turns out there's been a memory leak in journald after all, this
code has been there since at least 2013...

(cherry picked from commit b82aca89a5b366c4377b3b140e54313e817e8f57)
src/libsystemd/sd-journal/mmap-cache.c