Commit dd5347ee authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

wininet: Properly clean up ftp sessions.

parent c33a51ea
...@@ -2006,22 +2006,20 @@ HINTERNET FTP_Connect(LPWININETAPPINFOW hIC, LPCWSTR lpszServerName, ...@@ -2006,22 +2006,20 @@ HINTERNET FTP_Connect(LPWININETAPPINFOW hIC, LPCWSTR lpszServerName,
} }
lerror: lerror:
if (!bSuccess && nsocket != -1) if (lpwfs) WININET_Release( &lpwfs->hdr );
closesocket(nsocket);
if (!bSuccess && lpwfs) if (!bSuccess && handle)
{ {
HeapFree(GetProcessHeap(), 0, lpwfs); WININET_Release( &hIC->hdr );
WININET_FreeHandle( handle ); WININET_FreeHandle( handle );
handle = NULL; handle = NULL;
lpwfs = NULL;
} }
if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC) if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC)
{ {
INTERNET_ASYNC_RESULT iar; INTERNET_ASYNC_RESULT iar;
iar.dwResult = (DWORD)lpwfs; iar.dwResult = bSuccess ? (DWORD_PTR)lpwfs : 0;
iar.dwError = bSuccess ? ERROR_SUCCESS : INTERNET_GetLastError(); iar.dwError = bSuccess ? ERROR_SUCCESS : INTERNET_GetLastError();
SendAsyncCallback(&hIC->hdr, dwContext, INTERNET_STATUS_REQUEST_COMPLETE, SendAsyncCallback(&hIC->hdr, dwContext, INTERNET_STATUS_REQUEST_COMPLETE,
&iar, sizeof(INTERNET_ASYNC_RESULT)); &iar, sizeof(INTERNET_ASYNC_RESULT));
......
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