Skip to content

Commit

Permalink
gthread: Check if memory allocation was successful
Browse files Browse the repository at this point in the history
  • Loading branch information
Maschell committed Sep 3, 2022
1 parent 0edd2e9 commit 815dff3
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 815dff3

Please sign in to comment.