Hi Rob,
Robert Shearman wrote:
dlls/wininet/internet.c | 184 +++++------------------------------------------ dlls/wininet/internet.h | 3 - 2 files changed, 19 insertions(+), 168 deletions(-)
This also fixes a bug in the old code where starting a new asynchronous operation with more than 10 asynchronous operations in progress would fail.
...
- LPWORKREQUEST lpRequest = NULL;
LPWORKREQUEST lpRequest = lpvParam;
WORKREQUEST workRequest;
TRACE("\n");
- EnterCriticalSection(&csQueue);
- memcpy(&workRequest, lpRequest, sizeof(WORKREQUEST));
- HeapFree(GetProcessHeap(), 0, lpRequest);
- if (lpHeadWorkQueue)
- {
lpRequest = lpHeadWorkQueue;
lpHeadWorkQueue = lpHeadWorkQueue->prev;
- if (lpRequest == lpWorkQueueTail)
lpWorkQueueTail = lpHeadWorkQueue;
- }
- LeaveCriticalSection(&csQueue);
- if (lpRequest)
- {
memcpy(lpWorkRequest, lpRequest, sizeof(WORKREQUEST));
HeapFree(GetProcessHeap(), 0, lpRequest);
- bSuccess = TRUE;
- InterlockedDecrement(&dwNumJobs);
- }
- workRequest.asyncproc(&workRequest);
- return bSuccess;
- WININET_Release( workRequest.hdr );
- return TRUE;
}
Why do you copy lpRequest to workRequest? You could use lpRequest in asyncproc and WININET_Release and call HeapFree before return. Then workRequest may be removed.
Thanks, Jacek