]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fix leaking thread handles on Windows 3147/head
authorMa Lin <malincns@163.com>
Mon, 30 May 2022 00:18:54 +0000 (08:18 +0800)
committerMa Lin <malincns@163.com>
Mon, 30 May 2022 08:35:44 +0000 (16:35 +0800)
On Windows, thread handle should be closed explicitly.

Co-authored-by: luben karavelov <luben@users.noreply.github.com>
lib/common/threading.c

index 92cf57c195a5fb6263e8674a0b038bdbde59084c..4f69f7662860daf8e15897c214ce69d5377c59c6 100644 (file)
@@ -63,6 +63,8 @@ int ZSTD_pthread_join(ZSTD_pthread_t thread, void **value_ptr)
     if (!thread.handle) return 0;
 
     result = WaitForSingleObject(thread.handle, INFINITE);
+    CloseHandle(thread.handle);
+
     switch (result) {
     case WAIT_OBJECT_0:
         if (value_ptr) *value_ptr = thread.arg;