Alexandre Julliard : ntdll: Use malloc() to allocate async I/O data.

Alexandre Julliard julliard at winehq.org
Fri Jul 3 14:36:17 CDT 2020


Module: wine
Branch: master
Commit: e9951dbe37c9fb018e677d872df9f563a0861295
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=e9951dbe37c9fb018e677d872df9f563a0861295

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Jul  3 12:04:40 2020 +0200

ntdll: Use malloc() to allocate async I/O data.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/unix/file.c   | 18 +++++++++---------
 dlls/ntdll/unix/serial.c |  8 ++++----
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 5ed7a21d8e..223c863dca 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -4489,11 +4489,11 @@ static struct async_fileio *alloc_fileio( DWORD size, async_callback_t callback,
     while (io)
     {
         struct async_fileio *next = io->next;
-        RtlFreeHeap( GetProcessHeap(), 0, io );
+        free( io );
         io = next;
     }
 
-    if ((io = RtlAllocateHeap( GetProcessHeap(), 0, size )))
+    if ((io = malloc( size )))
     {
         io->callback = callback;
         io->handle   = handle;
@@ -4676,7 +4676,7 @@ static NTSTATUS server_read_file( HANDLE handle, HANDLE event, PIO_APC_ROUTINE a
     }
     SERVER_END_REQ;
 
-    if (status != STATUS_PENDING) RtlFreeHeap( GetProcessHeap(), 0, async );
+    if (status != STATUS_PENDING) free( async );
 
     if (wait_handle) status = wait_async( wait_handle, (options & FILE_SYNCHRONOUS_IO_ALERT), io );
     return status;
@@ -4714,7 +4714,7 @@ static NTSTATUS server_write_file( HANDLE handle, HANDLE event, PIO_APC_ROUTINE
     }
     SERVER_END_REQ;
 
-    if (status != STATUS_PENDING) RtlFreeHeap( GetProcessHeap(), 0, async );
+    if (status != STATUS_PENDING) free( async );
 
     if (wait_handle) status = wait_async( wait_handle, (options & FILE_SYNCHRONOUS_IO_ALERT), io );
     return status;
@@ -4759,7 +4759,7 @@ static NTSTATUS server_ioctl_file( HANDLE handle, HANDLE event,
         FIXME("Unsupported ioctl %x (device=%x access=%x func=%x method=%x)\n",
               code, code >> 16, (code >> 14) & 3, (code >> 2) & 0xfff, code & 3);
 
-    if (status != STATUS_PENDING) RtlFreeHeap( GetProcessHeap(), 0, async );
+    if (status != STATUS_PENDING) free( async );
 
     if (wait_handle) status = wait_async( wait_handle, (options & FILE_SYNCHRONOUS_IO_ALERT), io );
     return status;
@@ -4922,7 +4922,7 @@ static NTSTATUS register_async_file_read( HANDLE handle, HANDLE event,
     }
     SERVER_END_REQ;
 
-    if (status != STATUS_PENDING) RtlFreeHeap( GetProcessHeap(), 0, fileio );
+    if (status != STATUS_PENDING) free( fileio );
     return status;
 }
 
@@ -5388,7 +5388,7 @@ NTSTATUS WINAPI NtWriteFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, v
             }
             SERVER_END_REQ;
 
-            if (status != STATUS_PENDING) RtlFreeHeap( GetProcessHeap(), 0, fileio );
+            if (status != STATUS_PENDING) free( fileio );
             goto err;
         }
         else  /* synchronous write, wait for the fd to become ready */
@@ -5752,7 +5752,7 @@ NTSTATUS WINAPI NtFlushBuffersFile( HANDLE handle, IO_STATUS_BLOCK *io )
         }
         SERVER_END_REQ;
 
-        if (ret != STATUS_PENDING) RtlFreeHeap( GetProcessHeap(), 0, async );
+        if (ret != STATUS_PENDING) free( async );
 
         if (wait_handle) ret = wait_async( wait_handle, FALSE, io );
     }
@@ -5883,7 +5883,7 @@ NTSTATUS WINAPI NtNotifyChangeDirectoryFile( HANDLE handle, HANDLE event, PIO_AP
     }
     SERVER_END_REQ;
 
-    if (status != STATUS_PENDING) RtlFreeHeap( GetProcessHeap(), 0, fileio );
+    if (status != STATUS_PENDING) free( fileio );
     return status;
 }
 
diff --git a/dlls/ntdll/unix/serial.c b/dlls/ntdll/unix/serial.c
index b807ee1e46..1c61a5e02f 100644
--- a/dlls/ntdll/unix/serial.c
+++ b/dlls/ntdll/unix/serial.c
@@ -1007,7 +1007,7 @@ static DWORD CALLBACK wait_for_event(LPVOID arg)
     }
     stop_waiting(commio->hDevice);
     if (commio->hEvent) NtSetEvent(commio->hEvent, NULL);
-    RtlFreeHeap(GetProcessHeap(), 0, commio);
+    free( commio );
     return 0;
 }
 
@@ -1019,7 +1019,7 @@ static NTSTATUS wait_on(HANDLE hDevice, int fd, HANDLE hEvent, PIO_STATUS_BLOCK
     if ((status = NtResetEvent(hEvent, NULL)))
         return status;
 
-    commio = RtlAllocateHeap(GetProcessHeap(), 0, sizeof (async_commio));
+    commio = malloc( sizeof(async_commio) );
     if (!commio) return STATUS_NO_MEMORY;
 
     commio->hDevice = hDevice;
@@ -1030,7 +1030,7 @@ static NTSTATUS wait_on(HANDLE hDevice, int fd, HANDLE hEvent, PIO_STATUS_BLOCK
     status = get_wait_mask(commio->hDevice, &commio->evtmask, &commio->cookie, (commio->evtmask & EV_TXEMPTY) ? &commio->pending_write : NULL, TRUE);
     if (status)
     {
-        RtlFreeHeap(GetProcessHeap(), 0, commio);
+        free( commio );
         return status;
     }
 
@@ -1098,7 +1098,7 @@ error_caps:
 #endif
 out_now:
     stop_waiting(commio->hDevice);
-    RtlFreeHeap(GetProcessHeap(), 0, commio);
+    free( commio );
     return status;
 }
 




More information about the wine-cvs mailing list