diff --git a/lib/heap.c b/lib/heap.c index 28cb06a..a54e24a 100644 --- a/lib/heap.c +++ b/lib/heap.c @@ -16,6 +16,9 @@ page_t *page_create(size_t max, page_t *next) { + if (max == 0) + max = PAGE_DEFAULT_SIZE; + page_t *page = calloc(1, sizeof(*page) + max); page->available = max; page->next = next; diff --git a/lib/heap.h b/lib/heap.h index 97be975..c8db635 100644 --- a/lib/heap.h +++ b/lib/heap.h @@ -18,6 +18,8 @@ #include #include +#define PAGE_DEFAULT_SIZE 256 + typedef struct Page { struct Page *next;