From e03389c6a85ad2aa2ae11be193f3a95e1483cc31 Mon Sep 17 00:00:00 2001 From: Nikolay Nikolov Date: Wed, 7 Aug 2024 17:06:03 +0300 Subject: [PATCH] * WebAssembly threads: destroy the event and mutex in WasiBeginThread in case wasi_thread_spawn fails --- rtl/wasi/systhrd.inc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rtl/wasi/systhrd.inc b/rtl/wasi/systhrd.inc index fd30f6bf00..b7c3cdc9c6 100644 --- a/rtl/wasi/systhrd.inc +++ b/rtl/wasi/systhrd.inc @@ -399,6 +399,8 @@ begin else begin {$IFDEF DEBUGWASMTHREADS}DebugWriteln('WasiBeginThread: spawn thread failed');{$ENDIF} + WasiRTLEventDestroy(T^.DoneEvent); + DoneMutex(T^.Running); if Assigned(T^.StackBlock) then FreeMem(T^.StackBlock); if Assigned(T^.TLSBlock) then