diff --git a/core/alloc.c b/core/alloc.c index bfa5517..6b08a7c 100644 --- a/core/alloc.c +++ b/core/alloc.c @@ -126,6 +126,8 @@ static int allocSlab(struct slabDesc **desc, size_t size, size_t sizeSlab, int s ((*desc)->slab).freeEl = (char *)(*desc) + sizeof(struct slabDesc); } else { *desc = malloc(sizeof(struct slabDesc)); + if (*desc == NULL) + return -ENOMEM; (*desc)->slab.freeEl = (void *)alloc; } @@ -174,6 +176,8 @@ static int allocSlabEntry(struct slabEntry **desc, size_t size, size_t sizeSlab, (*desc)->freeEl = (char *)(*desc) + sizeof(struct slabEntry); } else { *desc = malloc(sizeof(struct slabEntry)); + if (*desc == NULL) + return -ENOMEM; (*desc)->freeEl = (void *)alloc; }