Browse Source

* WebAssembly threads: destroy the event and mutex in WasiBeginThread in case wasi_thread_spawn fails

Nikolay Nikolov 1 year ago
parent
commit
e03389c6a8
1 changed files with 2 additions and 0 deletions
  1. 2 0
      rtl/wasi/systhrd.inc

+ 2 - 0
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