Commit 7cb43c9d authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

Do not check for non NULL pointer before HeepFree'ing it. It's

redundant.
parent 8c6a442b
......@@ -372,12 +372,9 @@ BOOL WINAPI InternetGetCookieA(LPCSTR lpszUrl, LPCSTR lpszCookieName,
lpCookieData, *lpdwSize, NULL, NULL );
}
if( szCookieData )
HeapFree( GetProcessHeap(), 0, szCookieData );
if( szCookieName )
HeapFree( GetProcessHeap(), 0, szCookieName );
if( szUrl )
HeapFree( GetProcessHeap(), 0, szUrl );
HeapFree( GetProcessHeap(), 0, szCookieData );
HeapFree( GetProcessHeap(), 0, szCookieName );
HeapFree( GetProcessHeap(), 0, szUrl );
return r;
}
......@@ -499,12 +496,9 @@ BOOL WINAPI InternetSetCookieA(LPCSTR lpszUrl, LPCSTR lpszCookieName,
r = InternetSetCookieW( szUrl, szCookieName, szCookieData );
if( szCookieData )
HeapFree( GetProcessHeap(), 0, szCookieData );
if( szCookieName )
HeapFree( GetProcessHeap(), 0, szCookieName );
if( szUrl )
HeapFree( GetProcessHeap(), 0, szUrl );
HeapFree( GetProcessHeap(), 0, szCookieData );
HeapFree( GetProcessHeap(), 0, szCookieName );
HeapFree( GetProcessHeap(), 0, szUrl );
return r;
}
......@@ -165,8 +165,8 @@ BOOL WINAPI FtpPutFileA(HINTERNET hConnect, LPCSTR lpszLocalFile,
lpwzNewRemoteFile = lpszNewRemoteFile?WININET_strdup_AtoW(lpszNewRemoteFile):NULL;
ret = FtpPutFileW(hConnect, lpwzLocalFile, lpwzNewRemoteFile,
dwFlags, dwContext);
if(lpwzLocalFile) HeapFree(GetProcessHeap(), 0, lpwzLocalFile);
if(lpwzNewRemoteFile) HeapFree(GetProcessHeap(), 0, lpwzNewRemoteFile);
HeapFree(GetProcessHeap(), 0, lpwzLocalFile);
HeapFree(GetProcessHeap(), 0, lpwzNewRemoteFile);
return ret;
}
......@@ -322,7 +322,7 @@ BOOL WINAPI FtpSetCurrentDirectoryA(HINTERNET hConnect, LPCSTR lpszDirectory)
lpwzDirectory = lpszDirectory?WININET_strdup_AtoW(lpszDirectory):NULL;
ret = FtpSetCurrentDirectoryW(hConnect, lpwzDirectory);
if(lpwzDirectory) HeapFree(GetProcessHeap(), 0, lpwzDirectory);
HeapFree(GetProcessHeap(), 0, lpwzDirectory);
return ret;
}
......@@ -451,7 +451,7 @@ BOOL WINAPI FtpCreateDirectoryA(HINTERNET hConnect, LPCSTR lpszDirectory)
lpwzDirectory = lpszDirectory?WININET_strdup_AtoW(lpszDirectory):NULL;
ret = FtpCreateDirectoryW(hConnect, lpwzDirectory);
if(lpwzDirectory) HeapFree(GetProcessHeap(), 0, lpwzDirectory);
HeapFree(GetProcessHeap(), 0, lpwzDirectory);
return ret;
}
......@@ -579,7 +579,7 @@ HINTERNET WINAPI FtpFindFirstFileA(HINTERNET hConnect,
lpwzSearchFile = lpszSearchFile?WININET_strdup_AtoW(lpszSearchFile):NULL;
lpFindFileDataW = lpFindFileData?&wfd:NULL;
ret = FtpFindFirstFileW(hConnect, lpwzSearchFile, lpFindFileDataW, dwFlags, dwContext);
if(lpwzSearchFile) HeapFree(GetProcessHeap(), 0, lpwzSearchFile);
HeapFree(GetProcessHeap(), 0, lpwzSearchFile);
if(lpFindFileData) {
WININET_find_data_WtoA(lpFindFileDataW, lpFindFileData);
......@@ -907,7 +907,7 @@ HINTERNET WINAPI FtpOpenFileA(HINTERNET hFtpSession,
lpwzFileName = lpszFileName?WININET_strdup_AtoW(lpszFileName):NULL;
ret = FtpOpenFileW(hFtpSession, lpwzFileName, fdwAccess, dwFlags, dwContext);
if(lpwzFileName) HeapFree(GetProcessHeap(), 0, lpwzFileName);
HeapFree(GetProcessHeap(), 0, lpwzFileName);
return ret;
}
......@@ -1086,8 +1086,8 @@ BOOL WINAPI FtpGetFileA(HINTERNET hInternet, LPCSTR lpszRemoteFile, LPCSTR lpszN
lpwzNewFile = lpszNewFile?WININET_strdup_AtoW(lpszNewFile):NULL;
ret = FtpGetFileW(hInternet, lpwzRemoteFile, lpwzNewFile, fFailIfExists,
dwLocalFlagsAttribute, dwInternetFlags, dwContext);
if(lpwzRemoteFile) HeapFree(GetProcessHeap(), 0, lpwzRemoteFile);
if(lpwzNewFile) HeapFree(GetProcessHeap(), 0, lpwzNewFile);
HeapFree(GetProcessHeap(), 0, lpwzRemoteFile);
HeapFree(GetProcessHeap(), 0, lpwzNewFile);
return ret;
}
......@@ -1251,7 +1251,7 @@ BOOL WINAPI FtpDeleteFileA(HINTERNET hFtpSession, LPCSTR lpszFileName)
lpwzFileName = lpszFileName?WININET_strdup_AtoW(lpszFileName):NULL;
ret = FtpDeleteFileW(hFtpSession, lpwzFileName);
if(lpwzFileName) HeapFree(GetProcessHeap(), 0, lpwzFileName);
HeapFree(GetProcessHeap(), 0, lpwzFileName);
return ret;
}
......@@ -1370,7 +1370,7 @@ BOOL WINAPI FtpRemoveDirectoryA(HINTERNET hFtpSession, LPCSTR lpszDirectory)
lpwzDirectory = lpszDirectory?WININET_strdup_AtoW(lpszDirectory):NULL;
ret = FtpRemoveDirectoryW(hFtpSession, lpwzDirectory);
if(lpwzDirectory) HeapFree(GetProcessHeap(), 0, lpwzDirectory);
HeapFree(GetProcessHeap(), 0, lpwzDirectory);
return ret;
}
......@@ -1492,8 +1492,8 @@ BOOL WINAPI FtpRenameFileA(HINTERNET hFtpSession, LPCSTR lpszSrc, LPCSTR lpszDes
lpwzSrc = lpszSrc?WININET_strdup_AtoW(lpszSrc):NULL;
lpwzDest = lpszDest?WININET_strdup_AtoW(lpszDest):NULL;
ret = FtpRenameFileW(hFtpSession, lpwzSrc, lpwzDest);
if(lpwzSrc) HeapFree(GetProcessHeap(), 0, lpwzSrc);
if(lpwzDest) HeapFree(GetProcessHeap(), 0, lpwzDest);
HeapFree(GetProcessHeap(), 0, lpwzSrc);
HeapFree(GetProcessHeap(), 0, lpwzDest);
return ret;
}
......
......@@ -477,10 +477,10 @@ end:
}
HeapFree(GetProcessHeap(), 0, szAcceptTypes);
}
if (szReferrer) HeapFree(GetProcessHeap(), 0, szReferrer);
if (szVersion) HeapFree(GetProcessHeap(), 0, szVersion);
if (szObjectName) HeapFree(GetProcessHeap(), 0, szObjectName);
if (szVerb) HeapFree(GetProcessHeap(), 0, szVerb);
HeapFree(GetProcessHeap(), 0, szReferrer);
HeapFree(GetProcessHeap(), 0, szVersion);
HeapFree(GetProcessHeap(), 0, szObjectName);
HeapFree(GetProcessHeap(), 0, szVerb);
return rc;
}
......@@ -1738,7 +1738,7 @@ BOOL WINAPI HTTP_HttpSendRequestW(LPWININETHTTPREQW lpwhr, LPCWSTR lpszHeaders,
HeapFree(GetProcessHeap(), 0, buf_url);
HeapFree(GetProcessHeap(), 0, buf_cookie);
HeapFree(GetProcessHeap(), 0, cookie_name);
if (domain) HeapFree(GetProcessHeap(), 0, domain);
HeapFree(GetProcessHeap(), 0, domain);
nPosStart = nPosEnd;
}
}
......@@ -1747,8 +1747,7 @@ BOOL WINAPI HTTP_HttpSendRequestW(LPWININETHTTPREQW lpwhr, LPCWSTR lpszHeaders,
lend:
if (requestString)
HeapFree(GetProcessHeap(), 0, requestString);
HeapFree(GetProcessHeap(), 0, requestString);
/* TODO: send notification for P3P header */
......
......@@ -299,8 +299,7 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
if (g_dwTlsErrIndex != TLS_OUT_OF_INDEXES)
{
LPVOID lpwite = TlsGetValue(g_dwTlsErrIndex);
if (lpwite)
HeapFree(GetProcessHeap(), 0, lpwite);
HeapFree(GetProcessHeap(), 0, lpwite);
}
break;
......@@ -587,12 +586,9 @@ HINTERNET WINAPI InternetOpenA(LPCSTR lpszAgent, DWORD dwAccessType,
rc = InternetOpenW(szAgent, dwAccessType, szProxy, szBypass, dwFlags);
if( szAgent )
HeapFree(GetProcessHeap(), 0, szAgent);
if( szProxy )
HeapFree(GetProcessHeap(), 0, szProxy);
if( szBypass )
HeapFree(GetProcessHeap(), 0, szBypass);
HeapFree(GetProcessHeap(), 0, szAgent);
HeapFree(GetProcessHeap(), 0, szProxy);
HeapFree(GetProcessHeap(), 0, szBypass);
return rc;
}
......@@ -819,9 +815,9 @@ HINTERNET WINAPI InternetConnectA(HINTERNET hInternet,
rc = InternetConnectW(hInternet, szServerName, nServerPort,
szUserName, szPassword, dwService, dwFlags, dwContext);
if (szServerName) HeapFree(GetProcessHeap(), 0, szServerName);
if (szUserName) HeapFree(GetProcessHeap(), 0, szUserName);
if (szPassword) HeapFree(GetProcessHeap(), 0, szPassword);
HeapFree(GetProcessHeap(), 0, szServerName);
HeapFree(GetProcessHeap(), 0, szUserName);
HeapFree(GetProcessHeap(), 0, szPassword);
return rc;
}
......@@ -2349,7 +2345,7 @@ HINTERNET WINAPI InternetOpenUrlA(HINTERNET hInternet, LPCSTR lpszUrl,
lenHeaders = MultiByteToWideChar(CP_ACP, 0, lpszHeaders, dwHeadersLength, NULL, 0 );
szHeaders = HeapAlloc(GetProcessHeap(), 0, lenHeaders*sizeof(WCHAR));
if(!szHeaders) {
if(szUrl) HeapFree(GetProcessHeap(), 0, szUrl);
HeapFree(GetProcessHeap(), 0, szUrl);
return (HINTERNET)NULL;
}
MultiByteToWideChar(CP_ACP, 0, lpszHeaders, dwHeadersLength, szHeaders, lenHeaders);
......@@ -2358,8 +2354,8 @@ HINTERNET WINAPI InternetOpenUrlA(HINTERNET hInternet, LPCSTR lpszUrl,
rc = InternetOpenUrlW(hInternet, szUrl, szHeaders,
lenHeaders, dwFlags, dwContext);
if(szUrl) HeapFree(GetProcessHeap(), 0, szUrl);
if(szHeaders) HeapFree(GetProcessHeap(), 0, szHeaders);
HeapFree(GetProcessHeap(), 0, szUrl);
HeapFree(GetProcessHeap(), 0, szHeaders);
return rc;
}
......
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