wininet: Consistently use the allocation macros.

This commit is contained in:
Hans Leidekker 2011-06-01 11:50:53 +02:00 committed by Alexandre Julliard
parent 14d4d1957d
commit 9acd1ef15f
8 changed files with 291 additions and 334 deletions

View File

@ -132,14 +132,14 @@ static cookie *COOKIE_findCookie(cookie_domain *domain, LPCWSTR lpszCookieName)
/* removes a cookie from the list, if its the last cookie we also remove the domain */ /* removes a cookie from the list, if its the last cookie we also remove the domain */
static void COOKIE_deleteCookie(cookie *deadCookie, BOOL deleteDomain) static void COOKIE_deleteCookie(cookie *deadCookie, BOOL deleteDomain)
{ {
HeapFree(GetProcessHeap(), 0, deadCookie->lpCookieName); heap_free(deadCookie->lpCookieName);
HeapFree(GetProcessHeap(), 0, deadCookie->lpCookieData); heap_free(deadCookie->lpCookieData);
list_remove(&deadCookie->entry); list_remove(&deadCookie->entry);
/* special case: last cookie, lets remove the domain to save memory */ /* special case: last cookie, lets remove the domain to save memory */
if (list_empty(&deadCookie->parent->cookie_list) && deleteDomain) if (list_empty(&deadCookie->parent->cookie_list) && deleteDomain)
COOKIE_deleteDomain(deadCookie->parent); COOKIE_deleteDomain(deadCookie->parent);
HeapFree(GetProcessHeap(), 0, deadCookie); heap_free(deadCookie);
} }
/* allocates a domain and adds it to the end */ /* allocates a domain and adds it to the end */
@ -251,13 +251,12 @@ static void COOKIE_deleteDomain(cookie_domain *deadDomain)
COOKIE_deleteCookie(LIST_ENTRY(cursor, cookie, entry), FALSE); COOKIE_deleteCookie(LIST_ENTRY(cursor, cookie, entry), FALSE);
list_remove(cursor); list_remove(cursor);
} }
heap_free(deadDomain->lpCookieDomain);
HeapFree(GetProcessHeap(), 0, deadDomain->lpCookieDomain); heap_free(deadDomain->lpCookiePath);
HeapFree(GetProcessHeap(), 0, deadDomain->lpCookiePath);
list_remove(&deadDomain->entry); list_remove(&deadDomain->entry);
HeapFree(GetProcessHeap(), 0, deadDomain); heap_free(deadDomain);
} }
BOOL get_cookie(const WCHAR *host, const WCHAR *path, WCHAR *cookie_data, DWORD *size) BOOL get_cookie(const WCHAR *host, const WCHAR *path, WCHAR *cookie_data, DWORD *size)
@ -406,11 +405,9 @@ BOOL WINAPI InternetGetCookieA(LPCSTR lpszUrl, LPCSTR lpszCookieName,
lpCookieData, *lpdwSize, NULL, NULL ); lpCookieData, *lpdwSize, NULL, NULL );
} }
} }
heap_free( szCookieData );
HeapFree( GetProcessHeap(), 0, szCookieData ); heap_free( name );
HeapFree( GetProcessHeap(), 0, name ); heap_free( url );
HeapFree( GetProcessHeap(), 0, url );
return r; return r;
} }
@ -447,12 +444,11 @@ BOOL set_cookie(LPCWSTR domain, LPCWSTR path, LPCWSTR cookie_name, LPCWSTR cooki
if (!(ptr = strchrW(ptr,';'))) break; if (!(ptr = strchrW(ptr,';'))) break;
*ptr++ = 0; *ptr++ = 0;
if (value != data) if (value != data) heap_free(value);
HeapFree(GetProcessHeap(), 0, value);
value = heap_alloc((ptr - data) * sizeof(WCHAR)); value = heap_alloc((ptr - data) * sizeof(WCHAR));
if (value == NULL) if (value == NULL)
{ {
HeapFree(GetProcessHeap(), 0, data); heap_free(data);
ERR("could not allocate the cookie value buffer\n"); ERR("could not allocate the cookie value buffer\n");
return FALSE; return FALSE;
} }
@ -521,8 +517,8 @@ BOOL set_cookie(LPCWSTR domain, LPCWSTR path, LPCWSTR cookie_name, LPCWSTR cooki
thisCookieDomain = COOKIE_addDomain(domain, path); thisCookieDomain = COOKIE_addDomain(domain, path);
else else
{ {
HeapFree(GetProcessHeap(),0,data); heap_free(data);
if (value != data) HeapFree(GetProcessHeap(), 0, value); if (value != data) heap_free(value);
return TRUE; return TRUE;
} }
} }
@ -535,13 +531,12 @@ BOOL set_cookie(LPCWSTR domain, LPCWSTR path, LPCWSTR cookie_name, LPCWSTR cooki
if (!expired && !COOKIE_addCookie(thisCookieDomain, cookie_name, value, expiry)) if (!expired && !COOKIE_addCookie(thisCookieDomain, cookie_name, value, expiry))
{ {
HeapFree(GetProcessHeap(),0,data); heap_free(data);
if (value != data) HeapFree(GetProcessHeap(), 0, value); if (value != data) heap_free(value);
return FALSE; return FALSE;
} }
heap_free(data);
HeapFree(GetProcessHeap(),0,data); if (value != data) heap_free(value);
if (value != data) HeapFree(GetProcessHeap(), 0, value);
return TRUE; return TRUE;
} }
@ -593,7 +588,7 @@ BOOL WINAPI InternetSetCookieW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName,
ret = set_cookie(hostName, path, cookie, data); ret = set_cookie(hostName, path, cookie, data);
HeapFree(GetProcessHeap(), 0, cookie); heap_free(cookie);
return ret; return ret;
} }
return set_cookie(hostName, path, lpszCookieName, lpCookieData); return set_cookie(hostName, path, lpszCookieName, lpCookieData);
@ -625,10 +620,9 @@ BOOL WINAPI InternetSetCookieA(LPCSTR lpszUrl, LPCSTR lpszCookieName,
r = InternetSetCookieW( url, name, data ); r = InternetSetCookieW( url, name, data );
HeapFree( GetProcessHeap(), 0, data ); heap_free( data );
HeapFree( GetProcessHeap(), 0, name ); heap_free( name );
HeapFree( GetProcessHeap(), 0, url ); heap_free( url );
return r; return r;
} }

View File

@ -264,7 +264,7 @@ static BOOL WININET_SetAuthorization( HINTERNET hRequest, LPWSTR username,
q = heap_strdupW(password); q = heap_strdupW(password);
if( !q ) if( !q )
{ {
HeapFree(GetProcessHeap(), 0, username); heap_free(username);
goto done; goto done;
} }
@ -272,18 +272,18 @@ static BOOL WININET_SetAuthorization( HINTERNET hRequest, LPWSTR username,
{ {
appinfo_t *hIC = session->appInfo; appinfo_t *hIC = session->appInfo;
HeapFree(GetProcessHeap(), 0, hIC->proxyUsername); heap_free(hIC->proxyUsername);
hIC->proxyUsername = p; hIC->proxyUsername = p;
HeapFree(GetProcessHeap(), 0, hIC->proxyPassword); heap_free(hIC->proxyPassword);
hIC->proxyPassword = q; hIC->proxyPassword = q;
} }
else else
{ {
HeapFree(GetProcessHeap(), 0, session->userName); heap_free(session->userName);
session->userName = p; session->userName = p;
HeapFree(GetProcessHeap(), 0, session->password); heap_free(session->password);
session->password = q; session->password = q;
} }

View File

@ -246,8 +246,8 @@ BOOL WINAPI FtpPutFileA(HINTERNET hConnect, LPCSTR lpszLocalFile,
lpwzNewRemoteFile = heap_strdupAtoW(lpszNewRemoteFile); lpwzNewRemoteFile = heap_strdupAtoW(lpszNewRemoteFile);
ret = FtpPutFileW(hConnect, lpwzLocalFile, lpwzNewRemoteFile, ret = FtpPutFileW(hConnect, lpwzLocalFile, lpwzNewRemoteFile,
dwFlags, dwContext); dwFlags, dwContext);
HeapFree(GetProcessHeap(), 0, lpwzLocalFile); heap_free(lpwzLocalFile);
HeapFree(GetProcessHeap(), 0, lpwzNewRemoteFile); heap_free(lpwzNewRemoteFile);
return ret; return ret;
} }
@ -261,8 +261,8 @@ static void AsyncFtpPutFileProc(WORKREQUEST *workRequest)
FTP_FtpPutFileW(lpwfs, req->lpszLocalFile, FTP_FtpPutFileW(lpwfs, req->lpszLocalFile,
req->lpszNewRemoteFile, req->dwFlags, req->dwContext); req->lpszNewRemoteFile, req->dwFlags, req->dwContext);
HeapFree(GetProcessHeap(), 0, req->lpszLocalFile); heap_free(req->lpszLocalFile);
HeapFree(GetProcessHeap(), 0, req->lpszNewRemoteFile); heap_free(req->lpszNewRemoteFile);
} }
/*********************************************************************** /***********************************************************************
@ -432,7 +432,7 @@ BOOL WINAPI FtpSetCurrentDirectoryA(HINTERNET hConnect, LPCSTR lpszDirectory)
lpwzDirectory = heap_strdupAtoW(lpszDirectory); lpwzDirectory = heap_strdupAtoW(lpszDirectory);
ret = FtpSetCurrentDirectoryW(hConnect, lpwzDirectory); ret = FtpSetCurrentDirectoryW(hConnect, lpwzDirectory);
HeapFree(GetProcessHeap(), 0, lpwzDirectory); heap_free(lpwzDirectory);
return ret; return ret;
} }
@ -445,7 +445,7 @@ static void AsyncFtpSetCurrentDirectoryProc(WORKREQUEST *workRequest)
TRACE("%p\n", lpwfs); TRACE("%p\n", lpwfs);
FTP_FtpSetCurrentDirectoryW(lpwfs, req->lpszDirectory); FTP_FtpSetCurrentDirectoryW(lpwfs, req->lpszDirectory);
HeapFree(GetProcessHeap(), 0, req->lpszDirectory); heap_free(req->lpszDirectory);
} }
/*********************************************************************** /***********************************************************************
@ -578,7 +578,7 @@ BOOL WINAPI FtpCreateDirectoryA(HINTERNET hConnect, LPCSTR lpszDirectory)
lpwzDirectory = heap_strdupAtoW(lpszDirectory); lpwzDirectory = heap_strdupAtoW(lpszDirectory);
ret = FtpCreateDirectoryW(hConnect, lpwzDirectory); ret = FtpCreateDirectoryW(hConnect, lpwzDirectory);
HeapFree(GetProcessHeap(), 0, lpwzDirectory); heap_free(lpwzDirectory);
return ret; return ret;
} }
@ -591,7 +591,7 @@ static void AsyncFtpCreateDirectoryProc(WORKREQUEST *workRequest)
TRACE(" %p\n", lpwfs); TRACE(" %p\n", lpwfs);
FTP_FtpCreateDirectoryW(lpwfs, req->lpszDirectory); FTP_FtpCreateDirectoryW(lpwfs, req->lpszDirectory);
HeapFree(GetProcessHeap(), 0, req->lpszDirectory); heap_free(req->lpszDirectory);
} }
/*********************************************************************** /***********************************************************************
@ -728,7 +728,7 @@ HINTERNET WINAPI FtpFindFirstFileA(HINTERNET hConnect,
lpwzSearchFile = heap_strdupAtoW(lpszSearchFile); lpwzSearchFile = heap_strdupAtoW(lpszSearchFile);
lpFindFileDataW = lpFindFileData?&wfd:NULL; lpFindFileDataW = lpFindFileData?&wfd:NULL;
ret = FtpFindFirstFileW(hConnect, lpwzSearchFile, lpFindFileDataW, dwFlags, dwContext); ret = FtpFindFirstFileW(hConnect, lpwzSearchFile, lpFindFileDataW, dwFlags, dwContext);
HeapFree(GetProcessHeap(), 0, lpwzSearchFile); heap_free(lpwzSearchFile);
if (ret && lpFindFileData) if (ret && lpFindFileData)
WININET_find_data_WtoA(lpFindFileDataW, lpFindFileData); WININET_find_data_WtoA(lpFindFileDataW, lpFindFileData);
@ -746,7 +746,7 @@ static void AsyncFtpFindFirstFileProc(WORKREQUEST *workRequest)
FTP_FtpFindFirstFileW(lpwfs, req->lpszSearchFile, FTP_FtpFindFirstFileW(lpwfs, req->lpszSearchFile,
req->lpFindFileData, req->dwFlags, req->dwContext); req->lpFindFileData, req->dwFlags, req->dwContext);
HeapFree(GetProcessHeap(), 0, req->lpszSearchFile); heap_free(req->lpszSearchFile);
} }
/*********************************************************************** /***********************************************************************
@ -930,7 +930,7 @@ BOOL WINAPI FtpGetCurrentDirectoryA(HINTERNET hFtpSession, LPSTR lpszCurrentDire
WideCharToMultiByte(CP_ACP, 0, dir, -1, lpszCurrentDirectory, len, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, dir, -1, lpszCurrentDirectory, len, NULL, NULL);
if (lpdwCurrentDirectory) *lpdwCurrentDirectory = len; if (lpdwCurrentDirectory) *lpdwCurrentDirectory = len;
HeapFree(GetProcessHeap(), 0, dir); heap_free(dir);
return ret; return ret;
} }
@ -1076,7 +1076,7 @@ static BOOL FTP_FtpGetCurrentDirectoryW(ftp_session_t *lpwfs, LPWSTR lpszCurrent
} }
else INTERNET_SetLastError(ERROR_INSUFFICIENT_BUFFER); else INTERNET_SetLastError(ERROR_INSUFFICIENT_BUFFER);
HeapFree(GetProcessHeap(), 0, lpszResponseBuffer); heap_free(lpszResponseBuffer);
} }
else else
FTP_SetResponseError(nResCode); FTP_SetResponseError(nResCode);
@ -1115,7 +1115,7 @@ static void FTPFILE_Destroy(object_header_t *hdr)
if (lpwh->cache_file_handle != INVALID_HANDLE_VALUE) if (lpwh->cache_file_handle != INVALID_HANDLE_VALUE)
CloseHandle(lpwh->cache_file_handle); CloseHandle(lpwh->cache_file_handle);
HeapFree(GetProcessHeap(), 0, lpwh->cache_file); heap_free(lpwh->cache_file);
if (!lpwh->session_deleted) if (!lpwh->session_deleted)
lpwfs->download_in_progress = NULL; lpwfs->download_in_progress = NULL;
@ -1393,13 +1393,13 @@ static HINTERNET FTP_FtpOpenFileW(ftp_session_t *lpwfs,
if (lpwh->cache_file_handle == INVALID_HANDLE_VALUE) if (lpwh->cache_file_handle == INVALID_HANDLE_VALUE)
{ {
WARN("Could not create cache file: %u\n", GetLastError()); WARN("Could not create cache file: %u\n", GetLastError());
HeapFree(GetProcessHeap(), 0, lpwh->cache_file); heap_free(lpwh->cache_file);
lpwh->cache_file = NULL; lpwh->cache_file = NULL;
} }
} }
HeapFree(GetProcessHeap(), 0, url); heap_free(url);
} }
HeapFree(GetProcessHeap(), 0, uc.lpszUrlPath); heap_free(uc.lpszUrlPath);
} }
hIC = lpwfs->lpAppInfo; hIC = lpwfs->lpAppInfo;
@ -1454,7 +1454,7 @@ HINTERNET WINAPI FtpOpenFileA(HINTERNET hFtpSession,
lpwzFileName = heap_strdupAtoW(lpszFileName); lpwzFileName = heap_strdupAtoW(lpszFileName);
ret = FtpOpenFileW(hFtpSession, lpwzFileName, fdwAccess, dwFlags, dwContext); ret = FtpOpenFileW(hFtpSession, lpwzFileName, fdwAccess, dwFlags, dwContext);
HeapFree(GetProcessHeap(), 0, lpwzFileName); heap_free(lpwzFileName);
return ret; return ret;
} }
@ -1468,7 +1468,7 @@ static void AsyncFtpOpenFileProc(WORKREQUEST *workRequest)
FTP_FtpOpenFileW(lpwfs, req->lpszFilename, FTP_FtpOpenFileW(lpwfs, req->lpszFilename,
req->dwAccess, req->dwFlags, req->dwContext); req->dwAccess, req->dwFlags, req->dwContext);
HeapFree(GetProcessHeap(), 0, req->lpszFilename); heap_free(req->lpszFilename);
} }
/*********************************************************************** /***********************************************************************
@ -1570,8 +1570,8 @@ BOOL WINAPI FtpGetFileA(HINTERNET hInternet, LPCSTR lpszRemoteFile, LPCSTR lpszN
lpwzNewFile = heap_strdupAtoW(lpszNewFile); lpwzNewFile = heap_strdupAtoW(lpszNewFile);
ret = FtpGetFileW(hInternet, lpwzRemoteFile, lpwzNewFile, fFailIfExists, ret = FtpGetFileW(hInternet, lpwzRemoteFile, lpwzNewFile, fFailIfExists,
dwLocalFlagsAttribute, dwInternetFlags, dwContext); dwLocalFlagsAttribute, dwInternetFlags, dwContext);
HeapFree(GetProcessHeap(), 0, lpwzRemoteFile); heap_free(lpwzRemoteFile);
HeapFree(GetProcessHeap(), 0, lpwzNewFile); heap_free(lpwzNewFile);
return ret; return ret;
} }
@ -1586,8 +1586,8 @@ static void AsyncFtpGetFileProc(WORKREQUEST *workRequest)
FTP_FtpGetFileW(lpwfs, req->lpszRemoteFile, FTP_FtpGetFileW(lpwfs, req->lpszRemoteFile,
req->lpszNewFile, req->fFailIfExists, req->lpszNewFile, req->fFailIfExists,
req->dwLocalFlagsAttribute, req->dwFlags, req->dwContext); req->dwLocalFlagsAttribute, req->dwFlags, req->dwContext);
HeapFree(GetProcessHeap(), 0, req->lpszRemoteFile); heap_free(req->lpszRemoteFile);
HeapFree(GetProcessHeap(), 0, req->lpszNewFile); heap_free(req->lpszNewFile);
} }
@ -1778,7 +1778,7 @@ BOOL WINAPI FtpDeleteFileA(HINTERNET hFtpSession, LPCSTR lpszFileName)
lpwzFileName = heap_strdupAtoW(lpszFileName); lpwzFileName = heap_strdupAtoW(lpszFileName);
ret = FtpDeleteFileW(hFtpSession, lpwzFileName); ret = FtpDeleteFileW(hFtpSession, lpwzFileName);
HeapFree(GetProcessHeap(), 0, lpwzFileName); heap_free(lpwzFileName);
return ret; return ret;
} }
@ -1790,7 +1790,7 @@ static void AsyncFtpDeleteFileProc(WORKREQUEST *workRequest)
TRACE("%p\n", lpwfs); TRACE("%p\n", lpwfs);
FTP_FtpDeleteFileW(lpwfs, req->lpszFilename); FTP_FtpDeleteFileW(lpwfs, req->lpszFilename);
HeapFree(GetProcessHeap(), 0, req->lpszFilename); heap_free(req->lpszFilename);
} }
/*********************************************************************** /***********************************************************************
@ -1923,7 +1923,7 @@ BOOL WINAPI FtpRemoveDirectoryA(HINTERNET hFtpSession, LPCSTR lpszDirectory)
lpwzDirectory = heap_strdupAtoW(lpszDirectory); lpwzDirectory = heap_strdupAtoW(lpszDirectory);
ret = FtpRemoveDirectoryW(hFtpSession, lpwzDirectory); ret = FtpRemoveDirectoryW(hFtpSession, lpwzDirectory);
HeapFree(GetProcessHeap(), 0, lpwzDirectory); heap_free(lpwzDirectory);
return ret; return ret;
} }
@ -1935,7 +1935,7 @@ static void AsyncFtpRemoveDirectoryProc(WORKREQUEST *workRequest)
TRACE("%p\n", lpwfs); TRACE("%p\n", lpwfs);
FTP_FtpRemoveDirectoryW(lpwfs, req->lpszDirectory); FTP_FtpRemoveDirectoryW(lpwfs, req->lpszDirectory);
HeapFree(GetProcessHeap(), 0, req->lpszDirectory); heap_free(req->lpszDirectory);
} }
/*********************************************************************** /***********************************************************************
@ -2071,8 +2071,8 @@ BOOL WINAPI FtpRenameFileA(HINTERNET hFtpSession, LPCSTR lpszSrc, LPCSTR lpszDes
lpwzSrc = heap_strdupAtoW(lpszSrc); lpwzSrc = heap_strdupAtoW(lpszSrc);
lpwzDest = heap_strdupAtoW(lpszDest); lpwzDest = heap_strdupAtoW(lpszDest);
ret = FtpRenameFileW(hFtpSession, lpwzSrc, lpwzDest); ret = FtpRenameFileW(hFtpSession, lpwzSrc, lpwzDest);
HeapFree(GetProcessHeap(), 0, lpwzSrc); heap_free(lpwzSrc);
HeapFree(GetProcessHeap(), 0, lpwzDest); heap_free(lpwzDest);
return ret; return ret;
} }
@ -2084,8 +2084,8 @@ static void AsyncFtpRenameFileProc(WORKREQUEST *workRequest)
TRACE("%p\n", lpwfs); TRACE("%p\n", lpwfs);
FTP_FtpRenameFileW(lpwfs, req->lpszSrcFile, req->lpszDestFile); FTP_FtpRenameFileW(lpwfs, req->lpszSrcFile, req->lpszDestFile);
HeapFree(GetProcessHeap(), 0, req->lpszSrcFile); heap_free(req->lpszSrcFile);
HeapFree(GetProcessHeap(), 0, req->lpszDestFile); heap_free(req->lpszDestFile);
} }
/*********************************************************************** /***********************************************************************
@ -2239,7 +2239,7 @@ BOOL WINAPI FtpCommandA( HINTERNET hConnect, BOOL fExpectResponse, DWORD dwFlags
r = FtpCommandW(hConnect, fExpectResponse, dwFlags, cmdW, dwContext, phFtpCommand); r = FtpCommandW(hConnect, fExpectResponse, dwFlags, cmdW, dwContext, phFtpCommand);
HeapFree(GetProcessHeap(), 0, cmdW); heap_free(cmdW);
return r; return r;
} }
@ -2323,7 +2323,7 @@ BOOL WINAPI FtpCommandW( HINTERNET hConnect, BOOL fExpectResponse, DWORD dwFlags
lend: lend:
WININET_Release( &lpwfs->hdr ); WININET_Release( &lpwfs->hdr );
HeapFree(GetProcessHeap(), 0, cmd); heap_free( cmd );
return r; return r;
} }
@ -2341,9 +2341,9 @@ static void FTPSESSION_Destroy(object_header_t *hdr)
WININET_Release(&lpwfs->lpAppInfo->hdr); WININET_Release(&lpwfs->lpAppInfo->hdr);
HeapFree(GetProcessHeap(), 0, lpwfs->lpszPassword); heap_free(lpwfs->lpszPassword);
HeapFree(GetProcessHeap(), 0, lpwfs->lpszUserName); heap_free(lpwfs->lpszUserName);
HeapFree(GetProcessHeap(), 0, lpwfs->servername); heap_free(lpwfs->servername);
} }
static void FTPSESSION_CloseConnection(object_header_t *hdr) static void FTPSESSION_CloseConnection(object_header_t *hdr)
@ -2674,8 +2674,7 @@ static BOOL FTP_SendCommandA(INT nSocket, FTP_COMMAND ftpCmd, LPCSTR lpszParam,
nRC = send(nSocket, buf+nBytesSent, len - nBytesSent, 0); nRC = send(nSocket, buf+nBytesSent, len - nBytesSent, 0);
nBytesSent += nRC; nBytesSent += nRC;
} }
heap_free(buf);
HeapFree(GetProcessHeap(), 0, (LPVOID)buf);
if (lpfnStatusCB) if (lpfnStatusCB)
{ {
@ -2703,7 +2702,7 @@ static BOOL FTP_SendCommand(INT nSocket, FTP_COMMAND ftpCmd, LPCWSTR lpszParam,
BOOL ret; BOOL ret;
LPSTR lpszParamA = heap_strdupWtoA(lpszParam); LPSTR lpszParamA = heap_strdupWtoA(lpszParam);
ret = FTP_SendCommandA(nSocket, ftpCmd, lpszParamA, lpfnStatusCB, hdr, dwContext); ret = FTP_SendCommandA(nSocket, ftpCmd, lpszParamA, lpfnStatusCB, hdr, dwContext);
HeapFree(GetProcessHeap(), 0, lpszParamA); heap_free(lpszParamA);
return ret; return ret;
} }
@ -3279,8 +3278,7 @@ static BOOL FTP_SendData(ftp_session_t *lpwfs, INT nDataSocket, HANDLE hFile)
TRACE("file transfer complete!\n"); TRACE("file transfer complete!\n");
HeapFree(GetProcessHeap(), 0, lpszBuffer); heap_free(lpszBuffer);
return nTotalSent; return nTotalSent;
} }
@ -3371,9 +3369,8 @@ static BOOL FTP_RetrieveFileData(ftp_session_t *lpwfs, INT nDataSocket, HANDLE h
TRACE("Data transfer complete\n"); TRACE("Data transfer complete\n");
recv_end: recv_end:
HeapFree(GetProcessHeap(), 0, lpszBuffer); heap_free(lpszBuffer);
return (nRC != -1);
return (nRC != -1);
} }
/*********************************************************************** /***********************************************************************
@ -3392,10 +3389,9 @@ static void FTPFINDNEXT_Destroy(object_header_t *hdr)
for (i = 0; i < lpwfn->size; i++) for (i = 0; i < lpwfn->size; i++)
{ {
HeapFree(GetProcessHeap(), 0, lpwfn->lpafp[i].lpszName); heap_free(lpwfn->lpafp[i].lpszName);
} }
heap_free(lpwfn->lpafp);
HeapFree(GetProcessHeap(), 0, lpwfn->lpafp);
} }
static DWORD FTPFINDNEXT_FindNextFileProc(WININETFTPFINDNEXTW *find, LPVOID data) static DWORD FTPFINDNEXT_FindNextFileProc(WININETFTPFINDNEXTW *find, LPVOID data)
@ -3725,7 +3721,7 @@ static BOOL FTP_ParseNextFile(INT nSocket, LPCWSTR lpszSearchFile, LPFILEPROPERT
TRACE("Matched: %s\n", debugstr_w(lpfp->lpszName)); TRACE("Matched: %s\n", debugstr_w(lpfp->lpszName));
} }
else { else {
HeapFree(GetProcessHeap(), 0, lpfp->lpszName); heap_free(lpfp->lpszName);
lpfp->lpszName = NULL; lpfp->lpszName = NULL;
} }
} }
@ -3788,7 +3784,7 @@ static BOOL FTP_ParseDirectory(ftp_session_t *lpwfs, INT nSocket, LPCWSTR lpszSe
} }
else else
{ {
HeapFree(GetProcessHeap(), 0, *lpafp); heap_free(*lpafp);
INTERNET_SetLastError(ERROR_NO_MORE_FILES); INTERNET_SetLastError(ERROR_NO_MORE_FILES);
bSuccess = FALSE; bSuccess = FALSE;
} }

View File

@ -506,7 +506,7 @@ static voidpf wininet_zalloc(voidpf opaque, uInt items, uInt size)
static void wininet_zfree(voidpf opaque, voidpf address) static void wininet_zfree(voidpf opaque, voidpf address)
{ {
HeapFree(GetProcessHeap(), 0, address); heap_free(address);
} }
static DWORD init_gzip_stream(http_request_t *req) static DWORD init_gzip_stream(http_request_t *req)
@ -525,7 +525,7 @@ static DWORD init_gzip_stream(http_request_t *req)
zres = inflateInit2(&gzip_stream->zstream, 0x1f); zres = inflateInit2(&gzip_stream->zstream, 0x1f);
if(zres != Z_OK) { if(zres != Z_OK) {
ERR("inflateInit failed: %d\n", zres); ERR("inflateInit failed: %d\n", zres);
HeapFree(GetProcessHeap(), 0, gzip_stream); heap_free(gzip_stream);
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
} }
@ -615,9 +615,8 @@ static LPWSTR * HTTP_Tokenize(LPCWSTR string, LPCWSTR token_string)
static void HTTP_FreeTokens(LPWSTR * token_array) static void HTTP_FreeTokens(LPWSTR * token_array)
{ {
int i; int i;
for (i = 0; token_array[i]; i++) for (i = 0; token_array[i]; i++) heap_free(token_array[i]);
HeapFree(GetProcessHeap(), 0, token_array[i]); heap_free(token_array);
HeapFree(GetProcessHeap(), 0, token_array);
} }
static void HTTP_FixURL(http_request_t *request) static void HTTP_FixURL(http_request_t *request)
@ -650,7 +649,7 @@ static void HTTP_FixURL(http_request_t *request)
WCHAR *fixurl = heap_alloc((strlenW(request->path) + 2)*sizeof(WCHAR)); WCHAR *fixurl = heap_alloc((strlenW(request->path) + 2)*sizeof(WCHAR));
*fixurl = '/'; *fixurl = '/';
strcpyW(fixurl + 1, request->path); strcpyW(fixurl + 1, request->path);
HeapFree( GetProcessHeap(), 0, request->path ); heap_free( request->path );
request->path = fixurl; request->path = fixurl;
} }
} }
@ -700,7 +699,7 @@ static LPWSTR HTTP_BuildHeaderRequestString( http_request_t *request, LPCWSTR ve
req[n] = NULL; req[n] = NULL;
requestString = HTTP_build_req( req, 4 ); requestString = HTTP_build_req( req, 4 );
HeapFree( GetProcessHeap(), 0, req ); heap_free( req );
/* /*
* Set (header) termination string for request * Set (header) termination string for request
@ -816,9 +815,9 @@ static void destroy_authinfo( struct HttpAuthInfo *authinfo )
if (SecIsValidHandle(&authinfo->cred)) if (SecIsValidHandle(&authinfo->cred))
FreeCredentialsHandle(&authinfo->cred); FreeCredentialsHandle(&authinfo->cred);
HeapFree(GetProcessHeap(), 0, authinfo->auth_data); heap_free(authinfo->auth_data);
HeapFree(GetProcessHeap(), 0, authinfo->scheme); heap_free(authinfo->scheme);
HeapFree(GetProcessHeap(), 0, authinfo); heap_free(authinfo);
} }
static UINT retrieve_cached_basic_authorization(LPWSTR host, LPWSTR realm, LPSTR *auth_data) static UINT retrieve_cached_basic_authorization(LPWSTR host, LPWSTR realm, LPSTR *auth_data)
@ -865,7 +864,7 @@ static void cache_basic_authorization(LPWSTR host, LPWSTR realm, LPSTR auth_data
if (ad) if (ad)
{ {
TRACE("Found match in cache, replacing\n"); TRACE("Found match in cache, replacing\n");
HeapFree(GetProcessHeap(),0,ad->authorization); heap_free(ad->authorization);
ad->authorization = heap_alloc(auth_data_len); ad->authorization = heap_alloc(auth_data_len);
memcpy(ad->authorization, auth_data, auth_data_len); memcpy(ad->authorization, auth_data, auth_data_len);
ad->authorizationLen = auth_data_len; ad->authorizationLen = auth_data_len;
@ -901,9 +900,9 @@ static BOOL retrieve_cached_authorization(LPWSTR host, LPWSTR scheme,
nt_auth_identity->Domain = heap_alloc(sizeof(WCHAR)*ad->domain_len); nt_auth_identity->Domain = heap_alloc(sizeof(WCHAR)*ad->domain_len);
if(!nt_auth_identity->User || !nt_auth_identity->Password || if(!nt_auth_identity->User || !nt_auth_identity->Password ||
(!nt_auth_identity->Domain && ad->domain_len)) { (!nt_auth_identity->Domain && ad->domain_len)) {
HeapFree(GetProcessHeap(), 0, nt_auth_identity->User); heap_free(nt_auth_identity->User);
HeapFree(GetProcessHeap(), 0, nt_auth_identity->Password); heap_free(nt_auth_identity->Password);
HeapFree(GetProcessHeap(), 0, nt_auth_identity->Domain); heap_free(nt_auth_identity->Domain);
break; break;
} }
@ -937,9 +936,9 @@ static void cache_authorization(LPWSTR host, LPWSTR scheme,
} }
if(found) { if(found) {
HeapFree(GetProcessHeap(), 0, ad->user); heap_free(ad->user);
HeapFree(GetProcessHeap(), 0, ad->password); heap_free(ad->password);
HeapFree(GetProcessHeap(), 0, ad->domain); heap_free(ad->domain);
} else { } else {
ad = heap_alloc(sizeof(authorizationData)); ad = heap_alloc(sizeof(authorizationData));
if(!ad) { if(!ad) {
@ -961,13 +960,13 @@ static void cache_authorization(LPWSTR host, LPWSTR scheme,
if(!ad->host || !ad->scheme || !ad->user || !ad->password if(!ad->host || !ad->scheme || !ad->user || !ad->password
|| (nt_auth_identity->Domain && !ad->domain)) { || (nt_auth_identity->Domain && !ad->domain)) {
HeapFree(GetProcessHeap(), 0, ad->host); heap_free(ad->host);
HeapFree(GetProcessHeap(), 0, ad->scheme); heap_free(ad->scheme);
HeapFree(GetProcessHeap(), 0, ad->user); heap_free(ad->user);
HeapFree(GetProcessHeap(), 0, ad->password); heap_free(ad->password);
HeapFree(GetProcessHeap(), 0, ad->domain); heap_free(ad->domain);
list_remove(&ad->entry); list_remove(&ad->entry);
HeapFree(GetProcessHeap(), 0, ad); heap_free(ad);
} }
LeaveCriticalSection(&authcache_cs); LeaveCriticalSection(&authcache_cs);
@ -1008,7 +1007,7 @@ static BOOL HTTP_DoAuthorization( http_request_t *request, LPCWSTR pszAuthValue,
pAuthInfo->scheme = heap_strdupW(szBasic); pAuthInfo->scheme = heap_strdupW(szBasic);
if (!pAuthInfo->scheme) if (!pAuthInfo->scheme)
{ {
HeapFree(GetProcessHeap(), 0, pAuthInfo); heap_free(pAuthInfo);
return FALSE; return FALSE;
} }
} }
@ -1020,7 +1019,7 @@ static BOOL HTTP_DoAuthorization( http_request_t *request, LPCWSTR pszAuthValue,
pAuthInfo->scheme = heap_strdupW(pszAuthValue); pAuthInfo->scheme = heap_strdupW(pszAuthValue);
if (!pAuthInfo->scheme) if (!pAuthInfo->scheme)
{ {
HeapFree(GetProcessHeap(), 0, pAuthInfo); heap_free(pAuthInfo);
return FALSE; return FALSE;
} }
@ -1063,9 +1062,9 @@ static BOOL HTTP_DoAuthorization( http_request_t *request, LPCWSTR pszAuthValue,
&exp); &exp);
if(pAuthData && !domain_and_username) { if(pAuthData && !domain_and_username) {
HeapFree(GetProcessHeap(), 0, nt_auth_identity.User); heap_free(nt_auth_identity.User);
HeapFree(GetProcessHeap(), 0, nt_auth_identity.Domain); heap_free(nt_auth_identity.Domain);
HeapFree(GetProcessHeap(), 0, nt_auth_identity.Password); heap_free(nt_auth_identity.Password);
} }
if (sec_status == SEC_E_OK) if (sec_status == SEC_E_OK)
@ -1082,8 +1081,8 @@ static BOOL HTTP_DoAuthorization( http_request_t *request, LPCWSTR pszAuthValue,
{ {
WARN("AcquireCredentialsHandleW for scheme %s failed with error 0x%08x\n", WARN("AcquireCredentialsHandleW for scheme %s failed with error 0x%08x\n",
debugstr_w(pAuthInfo->scheme), sec_status); debugstr_w(pAuthInfo->scheme), sec_status);
HeapFree(GetProcessHeap(), 0, pAuthInfo->scheme); heap_free(pAuthInfo->scheme);
HeapFree(GetProcessHeap(), 0, pAuthInfo); heap_free(pAuthInfo);
return FALSE; return FALSE;
} }
} }
@ -1115,7 +1114,7 @@ static BOOL HTTP_DoAuthorization( http_request_t *request, LPCWSTR pszAuthValue,
auth_data_len = retrieve_cached_basic_authorization(host, szRealm,&auth_data); auth_data_len = retrieve_cached_basic_authorization(host, szRealm,&auth_data);
if (auth_data_len == 0) if (auth_data_len == 0)
{ {
HeapFree(GetProcessHeap(),0,szRealm); heap_free(szRealm);
return FALSE; return FALSE;
} }
} }
@ -1128,7 +1127,7 @@ static BOOL HTTP_DoAuthorization( http_request_t *request, LPCWSTR pszAuthValue,
auth_data = heap_alloc(userlen + 1 + passlen); auth_data = heap_alloc(userlen + 1 + passlen);
if (!auth_data) if (!auth_data)
{ {
HeapFree(GetProcessHeap(),0,szRealm); heap_free(szRealm);
return FALSE; return FALSE;
} }
@ -1143,8 +1142,7 @@ static BOOL HTTP_DoAuthorization( http_request_t *request, LPCWSTR pszAuthValue,
pAuthInfo->auth_data = auth_data; pAuthInfo->auth_data = auth_data;
pAuthInfo->auth_data_len = auth_data_len; pAuthInfo->auth_data_len = auth_data_len;
pAuthInfo->finished = TRUE; pAuthInfo->finished = TRUE;
HeapFree(GetProcessHeap(),0,szRealm); heap_free(szRealm);
return TRUE; return TRUE;
} }
else else
@ -1206,7 +1204,7 @@ static BOOL HTTP_DoAuthorization( http_request_t *request, LPCWSTR pszAuthValue,
else else
{ {
ERR("InitializeSecurityContextW returned error 0x%08x\n", sec_status); ERR("InitializeSecurityContextW returned error 0x%08x\n", sec_status);
HeapFree(GetProcessHeap(), 0, out.pvBuffer); heap_free(out.pvBuffer);
destroy_authinfo(pAuthInfo); destroy_authinfo(pAuthInfo);
*ppAuthInfo = NULL; *ppAuthInfo = NULL;
return FALSE; return FALSE;
@ -1280,8 +1278,7 @@ static DWORD HTTP_HttpAddRequestHeadersW(http_request_t *request,
lpszStart = lpszEnd; lpszStart = lpszEnd;
} while (res == ERROR_SUCCESS); } while (res == ERROR_SUCCESS);
HeapFree(GetProcessHeap(), 0, buffer); heap_free(buffer);
return res; return res;
} }
@ -1350,8 +1347,7 @@ BOOL WINAPI HttpAddRequestHeadersA(HINTERNET hHttpRequest,
r = HttpAddRequestHeadersW( hHttpRequest, hdr, dwHeaderLength, dwModifier ); r = HttpAddRequestHeadersW( hHttpRequest, hdr, dwHeaderLength, dwModifier );
HeapFree( GetProcessHeap(), 0, hdr ); heap_free( hdr );
return r; return r;
} }
@ -1463,16 +1459,15 @@ end:
acceptTypesCount = 0; acceptTypesCount = 0;
while (szAcceptTypes[acceptTypesCount]) while (szAcceptTypes[acceptTypesCount])
{ {
HeapFree(GetProcessHeap(), 0, szAcceptTypes[acceptTypesCount]); heap_free(szAcceptTypes[acceptTypesCount]);
acceptTypesCount++; acceptTypesCount++;
} }
HeapFree(GetProcessHeap(), 0, szAcceptTypes); heap_free(szAcceptTypes);
} }
HeapFree(GetProcessHeap(), 0, szReferrer); heap_free(szReferrer);
HeapFree(GetProcessHeap(), 0, szVersion); heap_free(szVersion);
HeapFree(GetProcessHeap(), 0, szObjectName); heap_free(szObjectName);
HeapFree(GetProcessHeap(), 0, szVerb); heap_free(szVerb);
return rc; return rc;
} }
@ -1641,7 +1636,7 @@ static BOOL HTTP_InsertAuthorization( http_request_t *request, struct HttpAuthIn
* connection tracking */ * connection tracking */
if (strcmpiW(pAuthInfo->scheme, wszBasic)) if (strcmpiW(pAuthInfo->scheme, wszBasic))
{ {
HeapFree(GetProcessHeap(), 0, pAuthInfo->auth_data); heap_free(pAuthInfo->auth_data);
pAuthInfo->auth_data = NULL; pAuthInfo->auth_data = NULL;
pAuthInfo->auth_data_len = 0; pAuthInfo->auth_data_len = 0;
} }
@ -1650,8 +1645,7 @@ static BOOL HTTP_InsertAuthorization( http_request_t *request, struct HttpAuthIn
TRACE("Inserting authorization: %s\n", debugstr_w(authorization)); TRACE("Inserting authorization: %s\n", debugstr_w(authorization));
HTTP_ProcessHeader(request, header, authorization, HTTP_ADDHDR_FLAG_REQ | HTTP_ADDHDR_FLAG_REPLACE); HTTP_ProcessHeader(request, header, authorization, HTTP_ADDHDR_FLAG_REQ | HTTP_ADDHDR_FLAG_REPLACE);
heap_free(authorization);
HeapFree(GetProcessHeap(), 0, authorization);
} }
return TRUE; return TRUE;
} }
@ -1728,7 +1722,7 @@ static BOOL HTTP_DealWithProxy(appinfo_t *hIC, http_session_t *session, http_req
if(UrlComponents.nPort == INTERNET_INVALID_PORT_NUMBER) if(UrlComponents.nPort == INTERNET_INVALID_PORT_NUMBER)
UrlComponents.nPort = INTERNET_DEFAULT_HTTP_PORT; UrlComponents.nPort = INTERNET_DEFAULT_HTTP_PORT;
HeapFree(GetProcessHeap(), 0, session->serverName); heap_free(session->serverName);
session->serverName = heap_strdupW(UrlComponents.lpszHostName); session->serverName = heap_strdupW(UrlComponents.lpszHostName);
session->serverPort = UrlComponents.nPort; session->serverPort = UrlComponents.nPort;
@ -1827,8 +1821,7 @@ static void HTTPREQ_Destroy(object_header_t *hdr)
request->rawHeaders, headersLen, NULL, 0); request->rawHeaders, headersLen, NULL, 0);
} }
} }
heap_free(request->cacheFile);
HeapFree(GetProcessHeap(), 0, request->cacheFile);
DeleteCriticalSection( &request->read_section ); DeleteCriticalSection( &request->read_section );
WININET_Release(&request->session->hdr); WININET_Release(&request->session->hdr);
@ -1836,20 +1829,19 @@ static void HTTPREQ_Destroy(object_header_t *hdr)
destroy_authinfo(request->authInfo); destroy_authinfo(request->authInfo);
destroy_authinfo(request->proxyAuthInfo); destroy_authinfo(request->proxyAuthInfo);
HeapFree(GetProcessHeap(), 0, request->path); heap_free(request->path);
HeapFree(GetProcessHeap(), 0, request->verb); heap_free(request->verb);
HeapFree(GetProcessHeap(), 0, request->rawHeaders); heap_free(request->rawHeaders);
HeapFree(GetProcessHeap(), 0, request->version); heap_free(request->version);
HeapFree(GetProcessHeap(), 0, request->statusText); heap_free(request->statusText);
for (i = 0; i < request->nCustHeaders; i++) for (i = 0; i < request->nCustHeaders; i++)
{ {
HeapFree(GetProcessHeap(), 0, request->custHeaders[i].lpszField); heap_free(request->custHeaders[i].lpszField);
HeapFree(GetProcessHeap(), 0, request->custHeaders[i].lpszValue); heap_free(request->custHeaders[i].lpszValue);
} }
destroy_data_stream(request->data_stream); destroy_data_stream(request->data_stream);
HeapFree(GetProcessHeap(), 0, request->custHeaders); heap_free(request->custHeaders);
} }
static void http_release_netconn(http_request_t *req, BOOL reuse) static void http_release_netconn(http_request_t *req, BOOL reuse)
@ -2083,7 +2075,7 @@ static DWORD HTTPREQ_QueryOption(object_header_t *hdr, DWORD option, void *buffe
ts->ftExpires = info->ExpireTime; ts->ftExpires = info->ExpireTime;
ts->ftLastModified = info->LastModifiedTime; ts->ftLastModified = info->LastModifiedTime;
HeapFree(GetProcessHeap(), 0, info); heap_free(info);
*size = sizeof(*ts); *size = sizeof(*ts);
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
@ -2193,12 +2185,12 @@ static DWORD HTTPREQ_SetOption(object_header_t *hdr, DWORD option, void *buffer,
*(DWORD*)buffer); *(DWORD*)buffer);
case INTERNET_OPTION_USERNAME: case INTERNET_OPTION_USERNAME:
HeapFree(GetProcessHeap(), 0, req->session->userName); heap_free(req->session->userName);
if (!(req->session->userName = heap_strdupW(buffer))) return ERROR_OUTOFMEMORY; if (!(req->session->userName = heap_strdupW(buffer))) return ERROR_OUTOFMEMORY;
return ERROR_SUCCESS; return ERROR_SUCCESS;
case INTERNET_OPTION_PASSWORD: case INTERNET_OPTION_PASSWORD:
HeapFree(GetProcessHeap(), 0, req->session->password); heap_free(req->session->password);
if (!(req->session->password = heap_strdupW(buffer))) return ERROR_OUTOFMEMORY; if (!(req->session->password = heap_strdupW(buffer))) return ERROR_OUTOFMEMORY;
return ERROR_SUCCESS; return ERROR_SUCCESS;
case INTERNET_OPTION_HTTP_DECODING: case INTERNET_OPTION_HTTP_DECODING:
@ -3342,8 +3334,7 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel,
} }
*lpdwBufferLength = len; *lpdwBufferLength = len;
if (request_only) if (request_only) heap_free(headers);
HeapFree(GetProcessHeap(), 0, headers);
return res; return res;
} }
case HTTP_QUERY_RAW_HEADERS: case HTTP_QUERY_RAW_HEADERS:
@ -3696,8 +3687,7 @@ BOOL WINAPI HttpQueryInfoA(HINTERNET hHttpRequest, DWORD dwInfoLevel,
* the Unicode characters can be reduced to a single byte */ * the Unicode characters can be reduced to a single byte */
*lpdwBufferLength = len / sizeof(WCHAR); *lpdwBufferLength = len / sizeof(WCHAR);
HeapFree(GetProcessHeap(), 0, bufferW ); heap_free( bufferW );
return result; return result;
} }
@ -3739,7 +3729,7 @@ static LPWSTR HTTP_GetRedirectURL(http_request_t *request, LPCWSTR lpszUrl)
url_length = url_length / sizeof(WCHAR) - 1; url_length = url_length / sizeof(WCHAR) - 1;
if (!InternetCreateUrlW(&urlComponents, 0, orig_url, &url_length)) if (!InternetCreateUrlW(&urlComponents, 0, orig_url, &url_length))
{ {
HeapFree(GetProcessHeap(), 0, orig_url); heap_free(orig_url);
return NULL; return NULL;
} }
@ -3747,18 +3737,18 @@ static LPWSTR HTTP_GetRedirectURL(http_request_t *request, LPCWSTR lpszUrl)
if (!InternetCombineUrlW(orig_url, lpszUrl, NULL, &url_length, ICU_ENCODE_SPACES_ONLY) && if (!InternetCombineUrlW(orig_url, lpszUrl, NULL, &url_length, ICU_ENCODE_SPACES_ONLY) &&
(GetLastError() != ERROR_INSUFFICIENT_BUFFER)) (GetLastError() != ERROR_INSUFFICIENT_BUFFER))
{ {
HeapFree(GetProcessHeap(), 0, orig_url); heap_free(orig_url);
return NULL; return NULL;
} }
combined_url = heap_alloc(url_length * sizeof(WCHAR)); combined_url = heap_alloc(url_length * sizeof(WCHAR));
if (!InternetCombineUrlW(orig_url, lpszUrl, combined_url, &url_length, ICU_ENCODE_SPACES_ONLY)) if (!InternetCombineUrlW(orig_url, lpszUrl, combined_url, &url_length, ICU_ENCODE_SPACES_ONLY))
{ {
HeapFree(GetProcessHeap(), 0, orig_url); heap_free(orig_url);
HeapFree(GetProcessHeap(), 0, combined_url); heap_free(combined_url);
return NULL; return NULL;
} }
HeapFree(GetProcessHeap(), 0, orig_url); heap_free(orig_url);
return combined_url; return combined_url;
} }
@ -3846,7 +3836,7 @@ static DWORD HTTP_HandleRedirect(http_request_t *request, LPCWSTR lpszUrl)
HTTP_ADDHDR_FLAG_ADD_IF_NEW); HTTP_ADDHDR_FLAG_ADD_IF_NEW);
#endif #endif
HeapFree(GetProcessHeap(), 0, session->hostName); heap_free(session->hostName);
if (urlComponents.nPort != INTERNET_DEFAULT_HTTP_PORT && if (urlComponents.nPort != INTERNET_DEFAULT_HTTP_PORT &&
urlComponents.nPort != INTERNET_DEFAULT_HTTPS_PORT) urlComponents.nPort != INTERNET_DEFAULT_HTTPS_PORT)
{ {
@ -3862,7 +3852,7 @@ static DWORD HTTP_HandleRedirect(http_request_t *request, LPCWSTR lpszUrl)
HTTP_ProcessHeader(request, hostW, session->hostName, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDREQ_FLAG_REPLACE | HTTP_ADDHDR_FLAG_REQ); HTTP_ProcessHeader(request, hostW, session->hostName, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDREQ_FLAG_REPLACE | HTTP_ADDHDR_FLAG_REQ);
HeapFree(GetProcessHeap(), 0, session->userName); heap_free(session->userName);
session->userName = NULL; session->userName = NULL;
if (userName[0]) if (userName[0])
session->userName = heap_strdupW(userName); session->userName = heap_strdupW(userName);
@ -3871,14 +3861,13 @@ static DWORD HTTP_HandleRedirect(http_request_t *request, LPCWSTR lpszUrl)
if(!using_proxy) { if(!using_proxy) {
if(strcmpiW(session->serverName, hostName)) { if(strcmpiW(session->serverName, hostName)) {
HeapFree(GetProcessHeap(), 0, session->serverName); heap_free(session->serverName);
session->serverName = heap_strdupW(hostName); session->serverName = heap_strdupW(hostName);
} }
session->serverPort = urlComponents.nPort; session->serverPort = urlComponents.nPort;
} }
} }
heap_free(request->path);
HeapFree(GetProcessHeap(), 0, request->path);
request->path=NULL; request->path=NULL;
if (*path) if (*path)
{ {
@ -3950,20 +3939,19 @@ static DWORD HTTP_SecureProxyConnect(http_request_t *request)
lpszPath = heap_alloc((lstrlenW( session->hostName ) + 13)*sizeof(WCHAR)); lpszPath = heap_alloc((lstrlenW( session->hostName ) + 13)*sizeof(WCHAR));
sprintfW( lpszPath, szFormat, session->hostName, session->hostPort ); sprintfW( lpszPath, szFormat, session->hostName, session->hostPort );
requestString = HTTP_BuildHeaderRequestString( request, szConnect, lpszPath, g_szHttp1_1 ); requestString = HTTP_BuildHeaderRequestString( request, szConnect, lpszPath, g_szHttp1_1 );
HeapFree( GetProcessHeap(), 0, lpszPath ); heap_free( lpszPath );
len = WideCharToMultiByte( CP_ACP, 0, requestString, -1, len = WideCharToMultiByte( CP_ACP, 0, requestString, -1,
NULL, 0, NULL, NULL ); NULL, 0, NULL, NULL );
len--; /* the nul terminator isn't needed */ len--; /* the nul terminator isn't needed */
ascii_req = heap_alloc(len); ascii_req = heap_alloc(len);
WideCharToMultiByte( CP_ACP, 0, requestString, -1, WideCharToMultiByte( CP_ACP, 0, requestString, -1, ascii_req, len, NULL, NULL );
ascii_req, len, NULL, NULL ); heap_free( requestString );
HeapFree( GetProcessHeap(), 0, requestString );
TRACE("full request -> %s\n", debugstr_an( ascii_req, len ) ); TRACE("full request -> %s\n", debugstr_an( ascii_req, len ) );
res = NETCON_send( request->netconn, ascii_req, len, 0, &cnt ); res = NETCON_send( request->netconn, ascii_req, len, 0, &cnt );
HeapFree( GetProcessHeap(), 0, ascii_req ); heap_free( ascii_req );
if (res != ERROR_SUCCESS) if (res != ERROR_SUCCESS)
return res; return res;
@ -4418,7 +4406,7 @@ static void HTTP_CacheRequest(http_request_t *request)
b = CreateUrlCacheEntryW(url, request->contentLength, NULL, cacheFileName, 0); b = CreateUrlCacheEntryW(url, request->contentLength, NULL, cacheFileName, 0);
if(b) { if(b) {
HeapFree(GetProcessHeap(), 0, request->cacheFile); heap_free(request->cacheFile);
CloseHandle(request->hCacheFile); CloseHandle(request->hCacheFile);
request->cacheFile = heap_strdupW(cacheFileName); request->cacheFile = heap_strdupW(cacheFileName);
@ -4583,7 +4571,7 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
sprintfW(agent_header, user_agent, request->session->appInfo->agent); sprintfW(agent_header, user_agent, request->session->appInfo->agent);
HTTP_HttpAddRequestHeadersW(request, agent_header, strlenW(agent_header), HTTP_ADDREQ_FLAG_ADD_IF_NEW); HTTP_HttpAddRequestHeadersW(request, agent_header, strlenW(agent_header), HTTP_ADDREQ_FLAG_ADD_IF_NEW);
HeapFree(GetProcessHeap(), 0, agent_header); heap_free(agent_header);
} }
if (request->hdr.dwFlags & INTERNET_FLAG_PRAGMA_NOCACHE) if (request->hdr.dwFlags & INTERNET_FLAG_PRAGMA_NOCACHE)
{ {
@ -4641,7 +4629,7 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
{ {
WCHAR *url = HTTP_BuildProxyRequestUrl(request); WCHAR *url = HTTP_BuildProxyRequestUrl(request);
requestString = HTTP_BuildHeaderRequestString(request, request->verb, url, request->version); requestString = HTTP_BuildHeaderRequestString(request, request->verb, url, request->version);
HeapFree(GetProcessHeap(), 0, url); heap_free(url);
} }
else else
requestString = HTTP_BuildHeaderRequestString(request, request->verb, request->path, request->version); requestString = HTTP_BuildHeaderRequestString(request, request->verb, request->path, request->version);
@ -4670,7 +4658,7 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
INTERNET_STATUS_SENDING_REQUEST, NULL, 0); INTERNET_STATUS_SENDING_REQUEST, NULL, 0);
res = NETCON_send(request->netconn, ascii_req, len, 0, &cnt); res = NETCON_send(request->netconn, ascii_req, len, 0, &cnt);
HeapFree( GetProcessHeap(), 0, ascii_req ); heap_free( ascii_req );
if(res != ERROR_SUCCESS) { if(res != ERROR_SUCCESS) {
TRACE("send failed: %u\n", res); TRACE("send failed: %u\n", res);
if(!reusing_connection) if(!reusing_connection)
@ -4737,7 +4725,7 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
if (strcmpW(request->verb, szGET) && strcmpW(request->verb, szHEAD) && if (strcmpW(request->verb, szGET) && strcmpW(request->verb, szHEAD) &&
dwStatusCode != HTTP_STATUS_REDIRECT_KEEP_VERB) dwStatusCode != HTTP_STATUS_REDIRECT_KEEP_VERB)
{ {
HeapFree(GetProcessHeap(), 0, request->verb); heap_free(request->verb);
request->verb = heap_strdupW(szGET); request->verb = heap_strdupW(szGET);
} }
drain_content(request); drain_content(request);
@ -4748,10 +4736,10 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
res = HTTP_HandleRedirect(request, new_url); res = HTTP_HandleRedirect(request, new_url);
if (res == ERROR_SUCCESS) if (res == ERROR_SUCCESS)
{ {
HeapFree(GetProcessHeap(), 0, requestString); heap_free(requestString);
loop_next = TRUE; loop_next = TRUE;
} }
HeapFree( GetProcessHeap(), 0, new_url ); heap_free( new_url );
} }
redirected = TRUE; redirected = TRUE;
} }
@ -4772,7 +4760,7 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
request->session->password, request->session->password,
Host->lpszValue)) Host->lpszValue))
{ {
HeapFree(GetProcessHeap(), 0, requestString); heap_free(requestString);
loop_next = TRUE; loop_next = TRUE;
break; break;
} }
@ -4817,8 +4805,7 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
HTTP_CacheRequest(request); HTTP_CacheRequest(request);
lend: lend:
heap_free(requestString);
HeapFree(GetProcessHeap(), 0, requestString);
/* TODO: send notification for P3P header */ /* TODO: send notification for P3P header */
@ -4857,7 +4844,7 @@ static void AsyncHttpSendRequestProc(WORKREQUEST *workRequest)
req->dwHeaderLength, req->lpOptional, req->dwOptionalLength, req->dwHeaderLength, req->lpOptional, req->dwOptionalLength,
req->dwContentLength, req->bEndRequest); req->dwContentLength, req->bEndRequest);
HeapFree(GetProcessHeap(), 0, req->lpszHeader); heap_free(req->lpszHeader);
} }
@ -4908,7 +4895,7 @@ static DWORD HTTP_HttpEndRequestW(http_request_t *request, DWORD dwFlags, DWORD_
if (strcmpW(request->verb, szGET) && strcmpW(request->verb, szHEAD) && if (strcmpW(request->verb, szGET) && strcmpW(request->verb, szHEAD) &&
dwCode != HTTP_STATUS_REDIRECT_KEEP_VERB) dwCode != HTTP_STATUS_REDIRECT_KEEP_VERB)
{ {
HeapFree(GetProcessHeap(), 0, request->verb); heap_free(request->verb);
request->verb = heap_strdupW(szGET); request->verb = heap_strdupW(szGET);
} }
drain_content(request); drain_content(request);
@ -4919,7 +4906,7 @@ static DWORD HTTP_HttpEndRequestW(http_request_t *request, DWORD dwFlags, DWORD_
res = HTTP_HandleRedirect(request, new_url); res = HTTP_HandleRedirect(request, new_url);
if (res == ERROR_SUCCESS) if (res == ERROR_SUCCESS)
res = HTTP_HttpSendRequestW(request, NULL, 0, NULL, 0, 0, TRUE); res = HTTP_HttpSendRequestW(request, NULL, 0, NULL, 0, 0, TRUE);
HeapFree( GetProcessHeap(), 0, new_url ); heap_free( new_url );
} }
} }
} }
@ -5083,8 +5070,7 @@ BOOL WINAPI HttpSendRequestExA(HINTERNET hRequest,
rc = HttpSendRequestExW(hRequest, lpBuffersIn ? &BuffersInW : NULL, NULL, dwFlags, dwContext); rc = HttpSendRequestExW(hRequest, lpBuffersIn ? &BuffersInW : NULL, NULL, dwFlags, dwContext);
HeapFree(GetProcessHeap(),0,header); heap_free(header);
return rc; return rc;
} }
@ -5299,8 +5285,8 @@ BOOL WINAPI HttpSendRequestA(HINTERNET hHttpRequest, LPCSTR lpszHeaders,
szHeaders = heap_alloc(nLen*sizeof(WCHAR)); szHeaders = heap_alloc(nLen*sizeof(WCHAR));
MultiByteToWideChar(CP_ACP,0,lpszHeaders,dwHeaderLength,szHeaders,nLen); MultiByteToWideChar(CP_ACP,0,lpszHeaders,dwHeaderLength,szHeaders,nLen);
} }
result=HttpSendRequestW(hHttpRequest, szHeaders, nLen, lpOptional, dwOptionalLength); result = HttpSendRequestW(hHttpRequest, szHeaders, nLen, lpOptional, dwOptionalLength);
HeapFree(GetProcessHeap(),0,szHeaders); heap_free(szHeaders);
return result; return result;
} }
@ -5318,10 +5304,10 @@ static void HTTPSESSION_Destroy(object_header_t *hdr)
WININET_Release(&session->appInfo->hdr); WININET_Release(&session->appInfo->hdr);
HeapFree(GetProcessHeap(), 0, session->hostName); heap_free(session->hostName);
HeapFree(GetProcessHeap(), 0, session->serverName); heap_free(session->serverName);
HeapFree(GetProcessHeap(), 0, session->password); heap_free(session->password);
HeapFree(GetProcessHeap(), 0, session->userName); heap_free(session->userName);
} }
static DWORD HTTPSESSION_QueryOption(object_header_t *hdr, DWORD option, void *buffer, DWORD *size, BOOL unicode) static DWORD HTTPSESSION_QueryOption(object_header_t *hdr, DWORD option, void *buffer, DWORD *size, BOOL unicode)
@ -5348,13 +5334,13 @@ static DWORD HTTPSESSION_SetOption(object_header_t *hdr, DWORD option, void *buf
switch(option) { switch(option) {
case INTERNET_OPTION_USERNAME: case INTERNET_OPTION_USERNAME:
{ {
HeapFree(GetProcessHeap(), 0, ses->userName); heap_free(ses->userName);
if (!(ses->userName = heap_strdupW(buffer))) return ERROR_OUTOFMEMORY; if (!(ses->userName = heap_strdupW(buffer))) return ERROR_OUTOFMEMORY;
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
case INTERNET_OPTION_PASSWORD: case INTERNET_OPTION_PASSWORD:
{ {
HeapFree(GetProcessHeap(), 0, ses->password); heap_free(ses->password);
if (!(ses->password = heap_strdupW(buffer))) return ERROR_OUTOFMEMORY; if (!(ses->password = heap_strdupW(buffer))) return ERROR_OUTOFMEMORY;
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
@ -5543,13 +5529,13 @@ static INT HTTP_GetResponseHeaders(http_request_t *request, BOOL clear)
{ {
WARN("No status line at head of response (%s)\n", debugstr_w(buffer)); WARN("No status line at head of response (%s)\n", debugstr_w(buffer));
HeapFree(GetProcessHeap(), 0, request->version); heap_free(request->version);
HeapFree(GetProcessHeap(), 0, request->statusText); heap_free(request->statusText);
request->version = heap_strdupW(g_szHttp1_0); request->version = heap_strdupW(g_szHttp1_0);
request->statusText = heap_strdupW(szOK); request->statusText = heap_strdupW(szOK);
HeapFree(GetProcessHeap(), 0, request->rawHeaders); heap_free(request->rawHeaders);
request->rawHeaders = heap_strdupW(szDefaultHeader); request->rawHeaders = heap_strdupW(szDefaultHeader);
bSuccess = TRUE; bSuccess = TRUE;
@ -5561,8 +5547,8 @@ static INT HTTP_GetResponseHeaders(http_request_t *request, BOOL clear)
HTTP_ProcessHeader(request, szStatus, status_code, HTTP_ProcessHeader(request, szStatus, status_code,
HTTP_ADDHDR_FLAG_REPLACE); HTTP_ADDHDR_FLAG_REPLACE);
HeapFree(GetProcessHeap(),0,request->version); heap_free(request->version);
HeapFree(GetProcessHeap(),0,request->statusText); heap_free(request->statusText);
request->version = heap_strdupW(buffer); request->version = heap_strdupW(buffer);
request->statusText = heap_strdupW(status_text); request->statusText = heap_strdupW(status_text);
@ -5640,7 +5626,7 @@ static INT HTTP_GetResponseHeaders(http_request_t *request, BOOL clear)
memcpy(&lpszRawHeaders[cchRawHeaders], szCrLf, sizeof(szCrLf)); memcpy(&lpszRawHeaders[cchRawHeaders], szCrLf, sizeof(szCrLf));
HeapFree(GetProcessHeap(), 0, request->rawHeaders); heap_free(request->rawHeaders);
request->rawHeaders = lpszRawHeaders; request->rawHeaders = lpszRawHeaders;
TRACE("raw headers: %s\n", debugstr_w(lpszRawHeaders)); TRACE("raw headers: %s\n", debugstr_w(lpszRawHeaders));
bSuccess = TRUE; bSuccess = TRUE;
@ -5652,7 +5638,7 @@ lend:
return rc; return rc;
else else
{ {
HeapFree(GetProcessHeap(), 0, lpszRawHeaders); heap_free(lpszRawHeaders);
return 0; return 0;
} }
} }
@ -5917,8 +5903,8 @@ static BOOL HTTP_DeleteCustomHeader(http_request_t *request, DWORD index)
return FALSE; return FALSE;
request->nCustHeaders--; request->nCustHeaders--;
HeapFree(GetProcessHeap(), 0, request->custHeaders[index].lpszField); heap_free(request->custHeaders[index].lpszField);
HeapFree(GetProcessHeap(), 0, request->custHeaders[index].lpszValue); heap_free(request->custHeaders[index].lpszValue);
memmove( &request->custHeaders[index], &request->custHeaders[index+1], memmove( &request->custHeaders[index], &request->custHeaders[index+1],
(request->nCustHeaders - index)* sizeof(HTTPHEADERW) ); (request->nCustHeaders - index)* sizeof(HTTPHEADERW) );

View File

@ -300,27 +300,24 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
break; break;
case DLL_THREAD_DETACH: case DLL_THREAD_DETACH:
if (g_dwTlsErrIndex != TLS_OUT_OF_INDEXES) if (g_dwTlsErrIndex != TLS_OUT_OF_INDEXES)
{ {
LPVOID lpwite = TlsGetValue(g_dwTlsErrIndex); heap_free(TlsGetValue(g_dwTlsErrIndex));
HeapFree(GetProcessHeap(), 0, lpwite); }
} break;
break;
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
collect_connections(TRUE); collect_connections(TRUE);
NETCON_unload(); NETCON_unload();
URLCacheContainers_DeleteAll();
URLCacheContainers_DeleteAll(); if (g_dwTlsErrIndex != TLS_OUT_OF_INDEXES)
{
if (g_dwTlsErrIndex != TLS_OUT_OF_INDEXES) heap_free(TlsGetValue(g_dwTlsErrIndex));
{ TlsFree(g_dwTlsErrIndex);
HeapFree(GetProcessHeap(), 0, TlsGetValue(g_dwTlsErrIndex)); }
TlsFree(g_dwTlsErrIndex);
}
break; break;
} }
return TRUE; return TRUE;
} }
@ -497,8 +494,8 @@ BOOL WINAPI DetectAutoProxyUrl(LPSTR lpszAutoProxyUrl,
static void FreeProxyInfo( proxyinfo_t *lpwpi ) static void FreeProxyInfo( proxyinfo_t *lpwpi )
{ {
HeapFree(GetProcessHeap(), 0, lpwpi->lpszProxyServer); heap_free(lpwpi->lpszProxyServer);
HeapFree(GetProcessHeap(), 0, lpwpi->lpszProxyBypass); heap_free(lpwpi->lpszProxyBypass);
} }
/*********************************************************************** /***********************************************************************
@ -681,11 +678,11 @@ static VOID APPINFO_Destroy(object_header_t *hdr)
TRACE("%p\n",lpwai); TRACE("%p\n",lpwai);
HeapFree(GetProcessHeap(), 0, lpwai->agent); heap_free(lpwai->agent);
HeapFree(GetProcessHeap(), 0, lpwai->proxy); heap_free(lpwai->proxy);
HeapFree(GetProcessHeap(), 0, lpwai->proxyBypass); heap_free(lpwai->proxyBypass);
HeapFree(GetProcessHeap(), 0, lpwai->proxyUsername); heap_free(lpwai->proxyUsername);
HeapFree(GetProcessHeap(), 0, lpwai->proxyPassword); heap_free(lpwai->proxyPassword);
} }
static DWORD APPINFO_QueryOption(object_header_t *hdr, DWORD option, void *buffer, DWORD *size, BOOL unicode) static DWORD APPINFO_QueryOption(object_header_t *hdr, DWORD option, void *buffer, DWORD *size, BOOL unicode)
@ -925,10 +922,9 @@ HINTERNET WINAPI InternetOpenA(LPCSTR lpszAgent, DWORD dwAccessType,
rc = InternetOpenW(szAgent, dwAccessType, szProxy, szBypass, dwFlags); rc = InternetOpenW(szAgent, dwAccessType, szProxy, szBypass, dwFlags);
HeapFree(GetProcessHeap(), 0, szAgent); heap_free(szAgent);
HeapFree(GetProcessHeap(), 0, szProxy); heap_free(szProxy);
HeapFree(GetProcessHeap(), 0, szBypass); heap_free(szBypass);
return rc; return rc;
} }
@ -1093,10 +1089,8 @@ BOOL WINAPI InternetGetConnectedStateExA(LPDWORD lpdwStatus, LPSTR lpszConnectio
{ {
WideCharToMultiByte(CP_ACP,0,lpwszConnectionName,-1,lpszConnectionName, WideCharToMultiByte(CP_ACP,0,lpwszConnectionName,-1,lpszConnectionName,
dwNameLen, NULL, NULL); dwNameLen, NULL, NULL);
heap_free(lpwszConnectionName);
HeapFree(GetProcessHeap(),0,lpwszConnectionName);
} }
return rc; return rc;
} }
@ -1192,9 +1186,9 @@ HINTERNET WINAPI InternetConnectA(HINTERNET hInternet,
rc = InternetConnectW(hInternet, szServerName, nServerPort, rc = InternetConnectW(hInternet, szServerName, nServerPort,
szUserName, szPassword, dwService, dwFlags, dwContext); szUserName, szPassword, dwService, dwFlags, dwContext);
HeapFree(GetProcessHeap(), 0, szServerName); heap_free(szServerName);
HeapFree(GetProcessHeap(), 0, szUserName); heap_free(szUserName);
HeapFree(GetProcessHeap(), 0, szPassword); heap_free(szPassword);
return rc; return rc;
} }
@ -1441,13 +1435,13 @@ BOOL WINAPI InternetCrackUrlA(LPCSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags,
debugstr_an(lpUrlComponents->lpszUrlPath, lpUrlComponents->dwUrlPathLength), debugstr_an(lpUrlComponents->lpszUrlPath, lpUrlComponents->dwUrlPathLength),
debugstr_an(lpUrlComponents->lpszExtraInfo, lpUrlComponents->dwExtraInfoLength)); debugstr_an(lpUrlComponents->lpszExtraInfo, lpUrlComponents->dwExtraInfoLength));
} }
HeapFree(GetProcessHeap(), 0, lpwszUrl); heap_free(lpwszUrl);
HeapFree(GetProcessHeap(), 0, hostname); heap_free(hostname);
HeapFree(GetProcessHeap(), 0, username); heap_free(username);
HeapFree(GetProcessHeap(), 0, password); heap_free(password);
HeapFree(GetProcessHeap(), 0, path); heap_free(path);
HeapFree(GetProcessHeap(), 0, scheme); heap_free(scheme);
HeapFree(GetProcessHeap(), 0, extra); heap_free(extra);
return ret; return ret;
} }
@ -1581,7 +1575,7 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl_orig, DWORD dwUrlLength_orig, DWOR
url_tmp[dwUrlLength] = 0; url_tmp[dwUrlLength] = 0;
if (!(lpszUrl_decode = heap_alloc(len * sizeof(WCHAR)))) if (!(lpszUrl_decode = heap_alloc(len * sizeof(WCHAR))))
{ {
HeapFree(GetProcessHeap(), 0, url_tmp); heap_free(url_tmp);
INTERNET_SetLastError(ERROR_OUTOFMEMORY); INTERNET_SetLastError(ERROR_OUTOFMEMORY);
return FALSE; return FALSE;
} }
@ -1590,7 +1584,7 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl_orig, DWORD dwUrlLength_orig, DWOR
dwUrlLength = len; dwUrlLength = len;
lpszUrl = lpszUrl_decode; lpszUrl = lpszUrl_decode;
} }
HeapFree(GetProcessHeap(), 0, url_tmp); heap_free(url_tmp);
} }
lpszap = lpszUrl; lpszap = lpszUrl;
@ -1848,7 +1842,7 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl_orig, DWORD dwUrlLength_orig, DWOR
debugstr_wn(lpUC->lpszUrlPath,lpUC->dwUrlPathLength), debugstr_wn(lpUC->lpszUrlPath,lpUC->dwUrlPathLength),
debugstr_wn(lpUC->lpszExtraInfo,lpUC->dwExtraInfoLength)); debugstr_wn(lpUC->lpszExtraInfo,lpUC->dwExtraInfoLength));
HeapFree(GetProcessHeap(), 0, lpszUrl_decode ); heap_free( lpszUrl_decode );
return TRUE; return TRUE;
} }
@ -2675,7 +2669,7 @@ BOOL WINAPI InternetSetOptionW(HINTERNET hInternet, DWORD dwOption,
switch (option->dwOption) { switch (option->dwOption) {
case INTERNET_PER_CONN_PROXY_SERVER: case INTERNET_PER_CONN_PROXY_SERVER:
HeapFree(GetProcessHeap(), 0, pi.lpszProxyServer); heap_free(pi.lpszProxyServer);
pi.lpszProxyServer = heap_strdupW(option->Value.pszValue); pi.lpszProxyServer = heap_strdupW(option->Value.pszValue);
break; break;
@ -2870,15 +2864,15 @@ BOOL WINAPI InternetSetOptionA(HINTERNET hInternet, DWORD dwOption,
case INTERNET_PER_CONN_PROXY_SERVER: case INTERNET_PER_CONN_PROXY_SERVER:
case INTERNET_PER_CONN_AUTOCONFIG_SECONDARY_URL: case INTERNET_PER_CONN_AUTOCONFIG_SECONDARY_URL:
case INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_URL: case INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_URL:
HeapFree( GetProcessHeap(), 0, opt->Value.pszValue ); heap_free( opt->Value.pszValue );
break; break;
default: default:
break; break;
} }
} }
HeapFree( GetProcessHeap(), 0, list->pOptions ); heap_free( list->pOptions );
} }
HeapFree( GetProcessHeap(), 0, wbuffer ); heap_free( wbuffer );
} }
return r; return r;
@ -2995,7 +2989,7 @@ BOOL WINAPI InternetTimeToSystemTimeA( LPCSTR string, SYSTEMTIME* time, DWORD re
if (stringW) if (stringW)
{ {
ret = InternetTimeToSystemTimeW( stringW, time, reserved ); ret = InternetTimeToSystemTimeW( stringW, time, reserved );
HeapFree( GetProcessHeap(), 0, stringW ); heap_free( stringW );
} }
return ret; return ret;
} }
@ -3179,8 +3173,7 @@ BOOL WINAPI InternetCheckConnectionW( LPCWSTR lpszUrl, DWORD dwFlags, DWORD dwRe
} }
End: End:
heap_free( command );
HeapFree( GetProcessHeap(), 0, command );
if (rc == FALSE) if (rc == FALSE)
INTERNET_SetLastError(ERROR_NOT_CONNECTED); INTERNET_SetLastError(ERROR_NOT_CONNECTED);
@ -3211,7 +3204,7 @@ BOOL WINAPI InternetCheckConnectionA(LPCSTR lpszUrl, DWORD dwFlags, DWORD dwRese
rc = InternetCheckConnectionW(url, dwFlags, dwReserved); rc = InternetCheckConnectionW(url, dwFlags, dwReserved);
HeapFree(GetProcessHeap(), 0, url); heap_free(url);
return rc; return rc;
} }
@ -3298,7 +3291,7 @@ static HINTERNET INTERNET_InternetOpenUrlW(appinfo_t *hIC, LPCWSTR lpszUrl,
strcpyW(path_extra, urlComponents.lpszUrlPath); strcpyW(path_extra, urlComponents.lpszUrlPath);
strcatW(path_extra, urlComponents.lpszExtraInfo); strcatW(path_extra, urlComponents.lpszExtraInfo);
client1 = HttpOpenRequestW(client, NULL, path_extra, NULL, NULL, accept, dwFlags, dwContext); client1 = HttpOpenRequestW(client, NULL, path_extra, NULL, NULL, accept, dwFlags, dwContext);
HeapFree(GetProcessHeap(), 0, path_extra); heap_free(path_extra);
} }
else else
client1 = HttpOpenRequestW(client, NULL, path, NULL, NULL, accept, dwFlags, dwContext); client1 = HttpOpenRequestW(client, NULL, path, NULL, NULL, accept, dwFlags, dwContext);
@ -3345,8 +3338,8 @@ static void AsyncInternetOpenUrlProc(WORKREQUEST *workRequest)
INTERNET_InternetOpenUrlW(hIC, req->lpszUrl, INTERNET_InternetOpenUrlW(hIC, req->lpszUrl,
req->lpszHeaders, req->dwHeadersLength, req->dwFlags, req->dwContext); req->lpszHeaders, req->dwHeadersLength, req->dwFlags, req->dwContext);
HeapFree(GetProcessHeap(), 0, req->lpszUrl); heap_free(req->lpszUrl);
HeapFree(GetProcessHeap(), 0, req->lpszHeaders); heap_free(req->lpszHeaders);
} }
HINTERNET WINAPI InternetOpenUrlW(HINTERNET hInternet, LPCWSTR lpszUrl, HINTERNET WINAPI InternetOpenUrlW(HINTERNET hInternet, LPCWSTR lpszUrl,
@ -3432,7 +3425,7 @@ HINTERNET WINAPI InternetOpenUrlA(HINTERNET hInternet, LPCSTR lpszUrl,
lenHeaders = MultiByteToWideChar(CP_ACP, 0, lpszHeaders, dwHeadersLength, NULL, 0 ); lenHeaders = MultiByteToWideChar(CP_ACP, 0, lpszHeaders, dwHeadersLength, NULL, 0 );
szHeaders = heap_alloc(lenHeaders*sizeof(WCHAR)); szHeaders = heap_alloc(lenHeaders*sizeof(WCHAR));
if(!szHeaders) { if(!szHeaders) {
HeapFree(GetProcessHeap(), 0, szUrl); heap_free(szUrl);
return NULL; return NULL;
} }
MultiByteToWideChar(CP_ACP, 0, lpszHeaders, dwHeadersLength, szHeaders, lenHeaders); MultiByteToWideChar(CP_ACP, 0, lpszHeaders, dwHeadersLength, szHeaders, lenHeaders);
@ -3441,9 +3434,8 @@ HINTERNET WINAPI InternetOpenUrlA(HINTERNET hInternet, LPCSTR lpszUrl,
rc = InternetOpenUrlW(hInternet, szUrl, szHeaders, rc = InternetOpenUrlW(hInternet, szUrl, szHeaders,
lenHeaders, dwFlags, dwContext); lenHeaders, dwFlags, dwContext);
HeapFree(GetProcessHeap(), 0, szUrl); heap_free(szUrl);
HeapFree(GetProcessHeap(), 0, szHeaders); heap_free(szHeaders);
return rc; return rc;
} }
@ -3460,10 +3452,9 @@ static LPWITHREADERROR INTERNET_AllocThreadError(void)
if (!TlsSetValue(g_dwTlsErrIndex, lpwite)) if (!TlsSetValue(g_dwTlsErrIndex, lpwite))
{ {
HeapFree(GetProcessHeap(), 0, lpwite); heap_free(lpwite);
return NULL; return NULL;
} }
return lpwite; return lpwite;
} }
@ -3523,14 +3514,14 @@ static DWORD CALLBACK INTERNET_WorkerThreadFunc(LPVOID lpvParam)
TRACE("\n"); TRACE("\n");
workRequest = *lpRequest; workRequest = *lpRequest;
HeapFree(GetProcessHeap(), 0, lpRequest); heap_free(lpRequest);
workRequest.asyncproc(&workRequest); workRequest.asyncproc(&workRequest);
WININET_Release( workRequest.hdr ); WININET_Release( workRequest.hdr );
if (g_dwTlsErrIndex != TLS_OUT_OF_INDEXES) if (g_dwTlsErrIndex != TLS_OUT_OF_INDEXES)
{ {
HeapFree(GetProcessHeap(), 0, TlsGetValue(g_dwTlsErrIndex)); heap_free(TlsGetValue(g_dwTlsErrIndex));
TlsSetValue(g_dwTlsErrIndex, NULL); TlsSetValue(g_dwTlsErrIndex, NULL);
} }
return TRUE; return TRUE;
@ -3561,10 +3552,9 @@ DWORD INTERNET_AsyncCall(LPWORKREQUEST lpWorkRequest)
bSuccess = QueueUserWorkItem(INTERNET_WorkerThreadFunc, lpNewRequest, WT_EXECUTELONGFUNCTION); bSuccess = QueueUserWorkItem(INTERNET_WorkerThreadFunc, lpNewRequest, WT_EXECUTELONGFUNCTION);
if (!bSuccess) if (!bSuccess)
{ {
HeapFree(GetProcessHeap(), 0, lpNewRequest); heap_free(lpNewRequest);
return ERROR_INTERNET_ASYNC_THREAD_FAILED; return ERROR_INTERNET_ASYNC_THREAD_FAILED;
} }
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
@ -4028,14 +4018,13 @@ BOOL WINAPI InternetCreateUrlA(LPURL_COMPONENTSA lpUrlComponents, DWORD dwFlags,
if (ret) if (ret)
WideCharToMultiByte(CP_ACP, 0, urlW, -1, lpszUrl, *lpdwUrlLength + 1, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, urlW, -1, lpszUrl, *lpdwUrlLength + 1, NULL, NULL);
HeapFree(GetProcessHeap(), 0, urlCompW.lpszScheme); heap_free(urlCompW.lpszScheme);
HeapFree(GetProcessHeap(), 0, urlCompW.lpszHostName); heap_free(urlCompW.lpszHostName);
HeapFree(GetProcessHeap(), 0, urlCompW.lpszUserName); heap_free(urlCompW.lpszUserName);
HeapFree(GetProcessHeap(), 0, urlCompW.lpszPassword); heap_free(urlCompW.lpszPassword);
HeapFree(GetProcessHeap(), 0, urlCompW.lpszUrlPath); heap_free(urlCompW.lpszUrlPath);
HeapFree(GetProcessHeap(), 0, urlCompW.lpszExtraInfo); heap_free(urlCompW.lpszExtraInfo);
HeapFree(GetProcessHeap(), 0, urlW); heap_free(urlW);
return ret; return ret;
} }

View File

@ -210,7 +210,7 @@ static PCCERT_CONTEXT X509_to_cert_context(X509 *cert)
if (malloced) if (malloced)
free(buffer); free(buffer);
else else
HeapFree(GetProcessHeap(),0,buffer); heap_free(buffer);
return ret; return ret;
} }
@ -482,7 +482,7 @@ static DWORD init_openssl(void)
pCRYPTO_set_id_callback(ssl_thread_id); pCRYPTO_set_id_callback(ssl_thread_id);
num_ssl_locks = pCRYPTO_num_locks(); num_ssl_locks = pCRYPTO_num_locks();
ssl_locks = HeapAlloc(GetProcessHeap(), 0, num_ssl_locks * sizeof(CRITICAL_SECTION)); ssl_locks = heap_alloc(num_ssl_locks * sizeof(CRITICAL_SECTION));
if(!ssl_locks) if(!ssl_locks)
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
@ -582,7 +582,7 @@ void NETCON_unload(void)
{ {
int i; int i;
for (i = 0; i < num_ssl_locks; i++) DeleteCriticalSection(&ssl_locks[i]); for (i = 0; i < num_ssl_locks; i++) DeleteCriticalSection(&ssl_locks[i]);
HeapFree(GetProcessHeap(), 0, ssl_locks); heap_free(ssl_locks);
} }
#endif #endif
} }

View File

@ -469,15 +469,15 @@ static BOOL URLCacheContainers_AddContainer(LPCWSTR cache_prefix, LPCWSTR path,
pContainer->path = heap_strdupW(path); pContainer->path = heap_strdupW(path);
if (!pContainer->path) if (!pContainer->path)
{ {
HeapFree(GetProcessHeap(), 0, pContainer); heap_free(pContainer);
return FALSE; return FALSE;
} }
pContainer->cache_prefix = heap_alloc((cache_prefix_len + 1) * sizeof(WCHAR)); pContainer->cache_prefix = heap_alloc((cache_prefix_len + 1) * sizeof(WCHAR));
if (!pContainer->cache_prefix) if (!pContainer->cache_prefix)
{ {
HeapFree(GetProcessHeap(), 0, pContainer->path); heap_free(pContainer->path);
HeapFree(GetProcessHeap(), 0, pContainer); heap_free(pContainer);
return FALSE; return FALSE;
} }
@ -489,8 +489,8 @@ static BOOL URLCacheContainers_AddContainer(LPCWSTR cache_prefix, LPCWSTR path,
if ((pContainer->hMutex = CreateMutexW(NULL, FALSE, mutex_name)) == NULL) if ((pContainer->hMutex = CreateMutexW(NULL, FALSE, mutex_name)) == NULL)
{ {
ERR("couldn't create mutex (error is %d)\n", GetLastError()); ERR("couldn't create mutex (error is %d)\n", GetLastError());
HeapFree(GetProcessHeap(), 0, pContainer->path); heap_free(pContainer->path);
HeapFree(GetProcessHeap(), 0, pContainer); heap_free(pContainer);
return FALSE; return FALSE;
} }
@ -505,9 +505,9 @@ static void URLCacheContainer_DeleteContainer(URLCACHECONTAINER * pContainer)
URLCacheContainer_CloseIndex(pContainer); URLCacheContainer_CloseIndex(pContainer);
CloseHandle(pContainer->hMutex); CloseHandle(pContainer->hMutex);
HeapFree(GetProcessHeap(), 0, pContainer->path); heap_free(pContainer->path);
HeapFree(GetProcessHeap(), 0, pContainer->cache_prefix); heap_free(pContainer->cache_prefix);
HeapFree(GetProcessHeap(), 0, pContainer); heap_free(pContainer);
} }
void URLCacheContainers_CreateDefaults(void) void URLCacheContainers_CreateDefaults(void)
@ -607,7 +607,7 @@ static DWORD URLCacheContainers_FindContainerA(LPCSTR lpszUrl, URLCACHECONTAINER
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
ret = URLCacheContainers_FindContainerW(url, ppContainer); ret = URLCacheContainers_FindContainerW(url, ppContainer);
HeapFree(GetProcessHeap(), 0, url); heap_free(url);
return ret; return ret;
} }
@ -1263,7 +1263,7 @@ static BOOL URLCache_FindHashW(LPCURLCACHE_HEADER pHeader, LPCWSTR lpszUrl, stru
} }
ret = URLCache_FindHash(pHeader, urlA, ppHashEntry); ret = URLCache_FindHash(pHeader, urlA, ppHashEntry);
HeapFree(GetProcessHeap(), 0, urlA); heap_free(urlA);
return ret; return ret;
} }
@ -2328,32 +2328,31 @@ BOOL WINAPI CreateUrlCacheEntryA(
if (lpszUrlName && (url_name = heap_strdupAtoW(lpszUrlName))) if (lpszUrlName && (url_name = heap_strdupAtoW(lpszUrlName)))
{ {
if (!lpszFileExtension || (file_extension = heap_strdupAtoW(lpszFileExtension))) if (!lpszFileExtension || (file_extension = heap_strdupAtoW(lpszFileExtension)))
{ {
if (CreateUrlCacheEntryW(url_name, dwExpectedFileSize, file_extension, file_name, dwReserved)) if (CreateUrlCacheEntryW(url_name, dwExpectedFileSize, file_extension, file_name, dwReserved))
{ {
if (WideCharToMultiByte(CP_ACP, 0, file_name, -1, lpszFileName, MAX_PATH, NULL, NULL) < MAX_PATH) if (WideCharToMultiByte(CP_ACP, 0, file_name, -1, lpszFileName, MAX_PATH, NULL, NULL) < MAX_PATH)
{ {
bSuccess = TRUE; bSuccess = TRUE;
} }
else else
{ {
dwError = GetLastError(); dwError = GetLastError();
} }
} }
else else
{ {
dwError = GetLastError(); dwError = GetLastError();
} }
HeapFree(GetProcessHeap(), 0, file_extension); heap_free(file_extension);
} }
else else
{ {
dwError = GetLastError(); dwError = GetLastError();
} }
HeapFree(GetProcessHeap(), 0, url_name); heap_free(url_name);
if (!bSuccess) if (!bSuccess) SetLastError(dwError);
SetLastError(dwError);
} }
return bSuccess; return bSuccess;
} }
@ -2796,8 +2795,8 @@ static BOOL CommitUrlCacheEntryInternal(
cleanup: cleanup:
URLCacheContainer_UnlockIndex(pContainer, pHeader); URLCacheContainer_UnlockIndex(pContainer, pHeader);
HeapFree(GetProcessHeap(), 0, lpszUrlNameA); heap_free(lpszUrlNameA);
HeapFree(GetProcessHeap(), 0, lpszFileExtensionA); heap_free(lpszFileExtensionA);
if (error == ERROR_SUCCESS) if (error == ERROR_SUCCESS)
return TRUE; return TRUE;
@ -2867,11 +2866,10 @@ BOOL WINAPI CommitUrlCacheEntryA(
file_extension, original_url); file_extension, original_url);
cleanup: cleanup:
HeapFree(GetProcessHeap(), 0, original_url); heap_free(original_url);
HeapFree(GetProcessHeap(), 0, file_extension); heap_free(file_extension);
HeapFree(GetProcessHeap(), 0, local_file_name); heap_free(local_file_name);
HeapFree(GetProcessHeap(), 0, url_name); heap_free(url_name);
return bSuccess; return bSuccess;
} }
@ -2918,7 +2916,7 @@ BOOL WINAPI CommitUrlCacheEntryW(
} }
if (header_info) if (header_info)
{ {
HeapFree(GetProcessHeap(), 0, header_info); heap_free(header_info);
if (!bSuccess) if (!bSuccess)
SetLastError(dwError); SetLastError(dwError);
} }
@ -3103,12 +3101,8 @@ BOOL WINAPI UnlockUrlCacheEntryStream(
if (!UnlockUrlCacheEntryFileA(pStream->lpszUrl, 0)) if (!UnlockUrlCacheEntryFileA(pStream->lpszUrl, 0))
return FALSE; return FALSE;
/* close file handle */
CloseHandle(pStream->hFile); CloseHandle(pStream->hFile);
heap_free(pStream);
/* free allocated space */
HeapFree(GetProcessHeap(), 0, pStream);
return TRUE; return TRUE;
} }
@ -3184,7 +3178,7 @@ BOOL WINAPI DeleteUrlCacheEntryW(LPCWSTR lpszUrlName)
error = URLCacheContainers_FindContainerW(lpszUrlName, &pContainer); error = URLCacheContainers_FindContainerW(lpszUrlName, &pContainer);
if (error != ERROR_SUCCESS) if (error != ERROR_SUCCESS)
{ {
HeapFree(GetProcessHeap(), 0, urlA); heap_free(urlA);
SetLastError(error); SetLastError(error);
return FALSE; return FALSE;
} }
@ -3192,14 +3186,14 @@ BOOL WINAPI DeleteUrlCacheEntryW(LPCWSTR lpszUrlName)
error = URLCacheContainer_OpenIndex(pContainer); error = URLCacheContainer_OpenIndex(pContainer);
if (error != ERROR_SUCCESS) if (error != ERROR_SUCCESS)
{ {
HeapFree(GetProcessHeap(), 0, urlA); heap_free(urlA);
SetLastError(error); SetLastError(error);
return FALSE; return FALSE;
} }
if (!(pHeader = URLCacheContainer_LockIndex(pContainer))) if (!(pHeader = URLCacheContainer_LockIndex(pContainer)))
{ {
HeapFree(GetProcessHeap(), 0, urlA); heap_free(urlA);
return FALSE; return FALSE;
} }
@ -3207,7 +3201,7 @@ BOOL WINAPI DeleteUrlCacheEntryW(LPCWSTR lpszUrlName)
{ {
URLCacheContainer_UnlockIndex(pContainer, pHeader); URLCacheContainer_UnlockIndex(pContainer, pHeader);
TRACE("entry %s not found!\n", debugstr_a(urlA)); TRACE("entry %s not found!\n", debugstr_a(urlA));
HeapFree(GetProcessHeap(), 0, urlA); heap_free(urlA);
SetLastError(ERROR_FILE_NOT_FOUND); SetLastError(ERROR_FILE_NOT_FOUND);
return FALSE; return FALSE;
} }
@ -3215,8 +3209,7 @@ BOOL WINAPI DeleteUrlCacheEntryW(LPCWSTR lpszUrlName)
ret = DeleteUrlCacheEntryInternal(pHeader, pHashEntry); ret = DeleteUrlCacheEntryInternal(pHeader, pHashEntry);
URLCacheContainer_UnlockIndex(pContainer, pHeader); URLCacheContainer_UnlockIndex(pContainer, pHeader);
heap_free(urlA);
HeapFree(GetProcessHeap(), 0, urlA);
return ret; return ret;
} }
@ -3360,7 +3353,7 @@ INTERNETAPI HANDLE WINAPI FindFirstUrlCacheEntryA(LPCSTR lpszUrlSearchPattern,
pEntryHandle->lpszUrlSearchPattern = heap_strdupAtoW(lpszUrlSearchPattern); pEntryHandle->lpszUrlSearchPattern = heap_strdupAtoW(lpszUrlSearchPattern);
if (!pEntryHandle->lpszUrlSearchPattern) if (!pEntryHandle->lpszUrlSearchPattern)
{ {
HeapFree(GetProcessHeap(), 0, pEntryHandle); heap_free(pEntryHandle);
return NULL; return NULL;
} }
} }
@ -3372,7 +3365,7 @@ INTERNETAPI HANDLE WINAPI FindFirstUrlCacheEntryA(LPCSTR lpszUrlSearchPattern,
if (!FindNextUrlCacheEntryA(pEntryHandle, lpFirstCacheEntryInfo, lpdwFirstCacheEntryInfoBufferSize)) if (!FindNextUrlCacheEntryA(pEntryHandle, lpFirstCacheEntryInfo, lpdwFirstCacheEntryInfoBufferSize))
{ {
HeapFree(GetProcessHeap(), 0, pEntryHandle); heap_free(pEntryHandle);
return NULL; return NULL;
} }
return pEntryHandle; return pEntryHandle;
@ -3399,7 +3392,7 @@ INTERNETAPI HANDLE WINAPI FindFirstUrlCacheEntryW(LPCWSTR lpszUrlSearchPattern,
pEntryHandle->lpszUrlSearchPattern = heap_strdupW(lpszUrlSearchPattern); pEntryHandle->lpszUrlSearchPattern = heap_strdupW(lpszUrlSearchPattern);
if (!pEntryHandle->lpszUrlSearchPattern) if (!pEntryHandle->lpszUrlSearchPattern)
{ {
HeapFree(GetProcessHeap(), 0, pEntryHandle); heap_free(pEntryHandle);
return NULL; return NULL;
} }
} }
@ -3411,7 +3404,7 @@ INTERNETAPI HANDLE WINAPI FindFirstUrlCacheEntryW(LPCWSTR lpszUrlSearchPattern,
if (!FindNextUrlCacheEntryW(pEntryHandle, lpFirstCacheEntryInfo, lpdwFirstCacheEntryInfoBufferSize)) if (!FindNextUrlCacheEntryW(pEntryHandle, lpFirstCacheEntryInfo, lpdwFirstCacheEntryInfoBufferSize))
{ {
HeapFree(GetProcessHeap(), 0, pEntryHandle); heap_free(pEntryHandle);
return NULL; return NULL;
} }
return pEntryHandle; return pEntryHandle;
@ -3545,9 +3538,8 @@ BOOL WINAPI FindCloseUrlCache(HANDLE hEnumHandle)
} }
pEntryHandle->dwMagic = 0; pEntryHandle->dwMagic = 0;
HeapFree(GetProcessHeap(), 0, pEntryHandle->lpszUrlSearchPattern); heap_free(pEntryHandle->lpszUrlSearchPattern);
HeapFree(GetProcessHeap(), 0, pEntryHandle); heap_free(pEntryHandle);
return TRUE; return TRUE;
} }

View File

@ -184,7 +184,7 @@ BOOL GetAddress(LPCWSTR lpszServerName, INTERNET_PORT nServerPort,
hints.ai_family = AF_INET; hints.ai_family = AF_INET;
ret = getaddrinfo( name, NULL, &hints, &res ); ret = getaddrinfo( name, NULL, &hints, &res );
HeapFree( GetProcessHeap(), 0, name ); heap_free( name );
if (ret != 0) if (ret != 0)
{ {
TRACE("failed to get IPv4 address of %s (%s), retrying with IPv6\n", debugstr_w(lpszServerName), gai_strerror(ret)); TRACE("failed to get IPv4 address of %s (%s), retrying with IPv6\n", debugstr_w(lpszServerName), gai_strerror(ret));
@ -219,7 +219,7 @@ BOOL GetAddress(LPCWSTR lpszServerName, INTERNET_PORT nServerPort,
#else #else
EnterCriticalSection( &cs_gethostbyname ); EnterCriticalSection( &cs_gethostbyname );
phe = gethostbyname(name); phe = gethostbyname(name);
HeapFree( GetProcessHeap(), 0, name ); heap_free( name );
if (NULL == phe) if (NULL == phe)
{ {
@ -341,7 +341,7 @@ VOID INTERNET_SendCallback(object_header_t *hdr, DWORD_PTR dwContext,
TRACE(" end callback().\n"); TRACE(" end callback().\n");
if(lpvNewInfo != lpvStatusInfo) if(lpvNewInfo != lpvStatusInfo)
HeapFree(GetProcessHeap(), 0, lpvNewInfo); heap_free(lpvNewInfo);
} }
static void SendAsyncCallbackProc(WORKREQUEST *workRequest) static void SendAsyncCallbackProc(WORKREQUEST *workRequest)
@ -355,7 +355,7 @@ static void SendAsyncCallbackProc(WORKREQUEST *workRequest)
req->dwStatusInfoLength); req->dwStatusInfoLength);
/* And frees the copy of the status info */ /* And frees the copy of the status info */
HeapFree(GetProcessHeap(), 0, req->lpvStatusInfo); heap_free(req->lpvStatusInfo);
} }
void SendAsyncCallback(object_header_t *hdr, DWORD_PTR dwContext, void SendAsyncCallback(object_header_t *hdr, DWORD_PTR dwContext,