wutstdc++: Check if memory allocations were successful on thread creation

This commit is contained in:
Maschell
2022-09-03 14:10:21 +02:00
committed by fincs
parent 80de7e3aac
commit 6c1388abd7

View File

@@ -24,9 +24,16 @@ __wut_thread_create(OSThread **outThread,
void *entryArgs)
{
OSThread *thread = (OSThread *)memalign(16, sizeof(OSThread));
char *stack = (char *)memalign(16, __WUT_STACK_SIZE);
if (!thread) {
return ENOMEM;
}
memset(thread, 0, sizeof(OSThread));
char *stack = (char *)memalign(16, __WUT_STACK_SIZE);
if (!stack) {
return ENOMEM;
}
if (!OSCreateThread(thread,
(OSThreadEntryPointFn)entryPoint,
(int)entryArgs,