Commit e9951dbe authored by Alexandre Julliard's avatar Alexandre Julliard

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

parent a07cff77
......@@ -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;
}
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment