aboutsummaryrefslogtreecommitdiff
path: root/libpager/object-terminate.c
diff options
context:
space:
mode:
authorSergey Bugaev <bugaevc@gmail.com>2021-05-06 15:56:31 +0300
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2021-05-07 00:13:54 +0200
commitec5632b9ba7fe4666307e7210245f3aa2f25de88 (patch)
tree08142ebf6362b7cb6297b18362cffe5ddbc84ac5 /libpager/object-terminate.c
parent93023e79f28a85b5e3f2a05c95b49719b3f72bb1 (diff)
downloadhurd-ec5632b9ba7fe4666307e7210245f3aa2f25de88.tar.gz
hurd-ec5632b9ba7fe4666307e7210245f3aa2f25de88.tar.bz2
hurd-ec5632b9ba7fe4666307e7210245f3aa2f25de88.zip
libpager: Use libc heap for pagemap
libc already implements the functionality for allocating and managing memory blocks like the pagemap. Using libc functions gives us some additional niceties like overflow checking in reallocarray (). it also means that we will not allocate a whole page of memory if we need to store just a few integers. Message-Id: <20210506125631.79117-7-bugaevc@gmail.com>
Diffstat (limited to 'libpager/object-terminate.c')
-rw-r--r--libpager/object-terminate.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libpager/object-terminate.c b/libpager/object-terminate.c
index 95298217..3e7df167 100644
--- a/libpager/object-terminate.c
+++ b/libpager/object-terminate.c
@@ -17,6 +17,7 @@
#include "priv.h"
#include "memory_object_S.h"
+#include <stdlib.h>
#include <stdio.h>
/* Implement the object termination call from the kernel as described
@@ -118,10 +119,10 @@ _pager_free_structure (struct pager *p)
/* Free the pagemap */
if (p->pagemapsize)
{
- munmap (p->pagemap, p->pagemapsize * sizeof (* p->pagemap));
+ free (p->pagemap);
p->pagemapsize = 0;
p->pagemap = 0;
}
-
+
p->pager_state = NOTINIT;
}