aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/core/kmalloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/core/kmalloc.c')
-rw-r--r--src/kernel/core/kmalloc.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/kernel/core/kmalloc.c b/src/kernel/core/kmalloc.c
index c977e54..cc20487 100644
--- a/src/kernel/core/kmalloc.c
+++ b/src/kernel/core/kmalloc.c
@@ -16,7 +16,10 @@ static void* page_alloc_fun_for_kmalloc(size_t bytes) {
for (void* i = addr; i < addr + bytes; i += PAGE_SIZE) {
int f = frame_alloc(1);
if (f == 0) goto failure;
- if (!pd_map_page(i, f, true)) goto failure;
+ if (!pd_map_page(i, f, true)) {
+ frame_free(f, 1);
+ goto failure;
+ }
}
return addr;
@@ -29,6 +32,7 @@ failure:
frame_free(f, 1);
}
}
+ region_free(addr);
return 0;
}