Skip to content

Commit

Permalink
wutstdc++: Check if memory allocations were successful on thread crea…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
Maschell authored and fincs committed Sep 17, 2022
1 parent 80de7e3 commit 6c1388a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion libraries/wutstdc++/wut_gthread_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 6c1388a

Please sign in to comment.