Skip to content

Commit

Permalink
Cache the error before potential side effects
Browse files Browse the repository at this point in the history
  • Loading branch information
waahm7 committed Jan 24, 2024
1 parent 6225ebb commit dc7cb4c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion source/event_loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,16 @@ static struct aws_event_loop_group *s_event_loop_group_new(

return el_group;

on_error:
on_error:;
/* cache the error code before potential side effects */
int cached_error_code = aws_last_error();

aws_mem_release(alloc, usable_cpus);
s_aws_event_loop_group_shutdown_sync(el_group);
s_event_loop_group_thread_exit(el_group);

/* raise the cached error code */
aws_raise_error(cached_error_code);
return NULL;
}

Expand Down

0 comments on commit dc7cb4c

Please sign in to comment.