summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2023-05-03 18:59:52 +0200
committerMaria Matejka <mq@ucw.cz>2023-05-06 10:50:31 +0200
commit1e998a434909b6ad5506c4b0084b7ad1ef3da2b1 (patch)
tree6d0090b27759693f97495ace82b6e68671e5f527
parented91d884d3f31eb0185c68d4cf1237cf56ed579e (diff)
Fixed cold page cache leak
The empty_pages pointer wasn't being propagated into the ->next pointer when more empty_pages were to be stored
-rw-r--r--sysdep/unix/alloc.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sysdep/unix/alloc.c b/sysdep/unix/alloc.c
index 2205f152..891a0e69 100644
--- a/sysdep/unix/alloc.c
+++ b/sysdep/unix/alloc.c
@@ -282,10 +282,13 @@ page_cleanup(void *_ UNUSED)
if (!empty_pages || (empty_pages->pos == EP_POS_MAX))
{
/* There is either no pointer block or the last block is full. We use this block as a pointer block. */
- empty_pages = (struct empty_pages *) fp;
- UNPROTECT_PAGE(empty_pages);
- *empty_pages = (struct empty_pages) {};
- PROTECT_PAGE(empty_pages);
+ struct empty_pages *ep = (struct empty_pages *) fp;
+ UNPROTECT_PAGE(ep);
+ *ep = (struct empty_pages) {
+ .next = empty_pages,
+ };
+ PROTECT_PAGE(ep);
+ empty_pages = ep;
}
else
{