From 48ed906a7ba7b1edcfc8cd658061408622990d9e Mon Sep 17 00:00:00 2001 From: Asahi Lina Date: Fri, 13 Dec 2024 04:47:41 +0900 Subject: [PATCH] Threads: Fix memory leak in joinable() --- Source/Tools/LinuxEmulation/LinuxSyscalls/Utils/Threads.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/Tools/LinuxEmulation/LinuxSyscalls/Utils/Threads.cpp b/Source/Tools/LinuxEmulation/LinuxSyscalls/Utils/Threads.cpp index 0b73a9e9d7..33ca4b0d15 100644 --- a/Source/Tools/LinuxEmulation/LinuxSyscalls/Utils/Threads.cpp +++ b/Source/Tools/LinuxEmulation/LinuxSyscalls/Utils/Threads.cpp @@ -211,9 +211,11 @@ namespace PThreads { int AttachState {}; if (pthread_attr_getdetachstate(&Attr, &AttachState) == 0) { if (AttachState == PTHREAD_CREATE_JOINABLE) { + pthread_attr_destroy(&Attr); return true; } } + pthread_attr_destroy(&Attr); } return false; }