summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYonggang Luo <luoyonggang@gmail.com>2022-04-20 04:12:41 +0800
committerMarge Bot <emma+marge@anholt.net>2022-06-15 17:37:17 +0000
commit09cd5c9bdb8c3c48fadcef6c92da2b67acbfcb47 (patch)
tree2b38a8f59a6250873bcf0077e7be2adcc5671019
parente6392fcf3d8b8dd7e3a8427755d8be2f2332366a (diff)
c11: Fixes memory leak of pack in thrd_create on win32
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15087>
-rw-r--r--src/c11/impl/threads_win32.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/c11/impl/threads_win32.c b/src/c11/impl/threads_win32.c
index 08c9475d81c..5d78542dab4 100644
--- a/src/c11/impl/threads_win32.c
+++ b/src/c11/impl/threads_win32.c
@@ -319,6 +319,7 @@ thrd_create(thrd_t *thr, thrd_start_t func, void *arg)
pack->arg = arg;
handle = _beginthreadex(NULL, 0, impl_thrd_routine, pack, 0, NULL);
if (handle == 0) {
+ free(pack);
if (errno == EAGAIN || errno == EACCES)
return thrd_nomem;
return thrd_error;