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>
This commit is contained in:
Yonggang Luo 2022-04-20 04:12:41 +08:00 committed by Marge Bot
parent e6392fcf3d
commit 09cd5c9bdb
1 changed files with 1 additions and 0 deletions

View File

@ -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;