From bb016e12d01754ecda4b3c3807343823ccf2a8cf Mon Sep 17 00:00:00 2001 From: Tatsuyuki Ishi Date: Sat, 17 Feb 2024 22:11:43 +0900 Subject: [PATCH] ntdll: Don't leak objattr allocation in NtCreateSemaphore. https://github.com/ValveSoftware/wine/pull/219 --- dlls/ntdll/unix/sync.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index 62a8d9d3171..4b62f255bd5 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -273,7 +273,6 @@ NTSTATUS WINAPI NtCreateSemaphore( HANDLE *handle, ACCESS_MASK access, const OBJ *handle = 0; if (max <= 0 || initial < 0 || initial > max) return STATUS_INVALID_PARAMETER; - if ((ret = alloc_object_attributes( attr, &objattr, &len ))) return ret; if (do_fsync()) return fsync_create_semaphore( handle, access, attr, initial, max ); @@ -281,6 +280,8 @@ NTSTATUS WINAPI NtCreateSemaphore( HANDLE *handle, ACCESS_MASK access, const OBJ if (do_esync()) return esync_create_semaphore( handle, access, attr, initial, max ); + if ((ret = alloc_object_attributes( attr, &objattr, &len ))) return ret; + SERVER_START_REQ( create_semaphore ) { req->access = access;