fix: check if zone is not null before explore it

This commit is contained in:
Starnakin 2024-11-20 16:26:01 +01:00
parent ec3a038a36
commit 94b2fa340c

View File

@ -13,7 +13,7 @@ void *alloc_frame(void)
struct frame_zone *it = head; struct frame_zone *it = head;
while (it && !it->remaining_frames) while (it && !it->remaining_frames)
it = it->next; it = it->next;
if (it->remaining_frames == 0) { if (!it || it->remaining_frames == 0) {
kprintf(KERN_CRIT "No memory zone available (ratio)\n"); kprintf(KERN_CRIT "No memory zone available (ratio)\n");
return NULL; return NULL;
} }