In the cases of failed allocation, `uk_posix_memalign()` is returning
an errno number but does not change `memptr`. Instead of checking
`memptr` being NULL, we test failures with `uk_posix_memalign()`'s
return codes.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
struct uk_sched *sched = uk_sched_get_default();
void *stack;
- uk_posix_memalign(sched->allocator,
- &stack, __STACK_SIZE, __STACK_SIZE);
- if (stack == NULL)
+ if (uk_posix_memalign(sched->allocator, &stack,
+ __STACK_SIZE, __STACK_SIZE) != 0)
printf("error allocating stack\n");
return stack;
}