summaryrefslogtreecommitdiff
path: root/kernel/kmalloc.c
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2024-04-26 16:06:35 +0200
committerAnton Kling <anton@kling.gg>2024-04-26 16:20:59 +0200
commit59e3f74a2e1a0806350e1ffd77a528821d1f2be3 (patch)
treea514572b0b9468f6ae3ba7cd075181c58c2371e7 /kernel/kmalloc.c
parent15bc439577c49e97c24a074fe6d9e9464f917054 (diff)
Kernel: More out of memory condition checks
Diffstat (limited to 'kernel/kmalloc.c')
-rw-r--r--kernel/kmalloc.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/kernel/kmalloc.c b/kernel/kmalloc.c
index 087609e..12e8232 100644
--- a/kernel/kmalloc.c
+++ b/kernel/kmalloc.c
@@ -12,7 +12,11 @@
void *kmalloc_align(size_t s, void **physical) {
// TODO: It should reuse virtual regions so that it does not run out
// of address space.
- return ksbrk_physical(s, physical);
+ void *rc;
+ if ((void *)-1 == (rc = ksbrk_physical(s, physical))) {
+ return NULL;
+ }
+ return rc;
}
void kmalloc_align_free(void *p, size_t s) {