Mesa (main): c11: Fixes memory leak of pack in thrd_create on win32

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 15 18:05:01 UTC 2022


Module: Mesa
Branch: main
Commit: 09cd5c9bdb8c3c48fadcef6c92da2b67acbfcb47
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=09cd5c9bdb8c3c48fadcef6c92da2b67acbfcb47

Author: Yonggang Luo <luoyonggang at gmail.com>
Date:   Wed Apr 20 04:12:41 2022 +0800

c11: Fixes memory leak of pack in thrd_create on win32

Signed-off-by: Yonggang Luo <luoyonggang at gmail.com>
Reviewed-by: Jesse Natalie <jenatali at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15087>

---

 src/c11/impl/threads_win32.c | 1 +
 1 file changed, 1 insertion(+)

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;



More information about the mesa-commit mailing list