From 3f194f1c7264945a63b0018b159cc83bd9385c59 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Mon, 26 Aug 2024 23:00:55 +0300 Subject: fix memory leaks destroying threads --- src/uapi/proc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/uapi/proc.c') diff --git a/src/uapi/proc.c b/src/uapi/proc.c index a99acb5..b010220 100644 --- a/src/uapi/proc.c +++ b/src/uapi/proc.c @@ -41,7 +41,11 @@ SYSCALL_DEFINE5(create)(struct tcb *t, sys_arg_t func, /** @todo there's quite a bit of overlap between this and what * core_bringup() is doing, might separate this out into its own * function? */ - alloc_stack(c); + if (alloc_stack(c)) { + destroy_thread(c); + return_args1(t, ERR_OOMEM); + } + set_thread(c); set_ret5(c, c->tid, d0, d1, d2, d3); -- cgit v1.3