[PATCH 1/1] ntdll: Prevent double free (Coverity)

Fabian Maurer wine at gitlab.winehq.org
Mon May 16 11:53:08 CDT 2022


From: Fabian Maurer <dark.shadow4 at web.de>

The fd gets overwritten, therefore we need to close it before doing so.

Signed-off-by: Fabian Maurer <dark.shadow4 at web.de>
---
Supersedes patch 233975
---
 dlls/ntdll/unix/file.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index cc8bf0c6e82..83ff59fa1e6 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -4210,6 +4210,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
                 if (size > 0x10000) size = 0x10000;
                 if ((tmpbuf = malloc( size )))
                 {
+                    if (needs_close) close( fd );
                     if (!server_get_unix_fd( handle, FILE_READ_DATA, &fd, &needs_close, NULL, NULL ))
                     {
                         int res = recv( fd, tmpbuf, size, MSG_PEEK );
-- 
GitLab

https://gitlab.winehq.org/wine/wine/-/merge_requests/74



More information about the wine-devel mailing list