Adding support for the brk system call
[akaros.git] / kern / src / page_alloc.c
index 6dcba14..fcbe64a 100644 (file)
@@ -288,6 +288,10 @@ void page_decref(page_t *page)
  */
 static void __page_decref(page_t *page)
 {
+       if (page->page_ref == 0) {
+               warn("Trying to Free already freed page...\n");
+               return;
+       }
        if (--page->page_ref == 0)
                __page_free(page);
 }