Commit 99f651bd authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

wininet: The lpszLocalFileName parameter to CommitUrlCacheEntryA is optional, so…

wininet: The lpszLocalFileName parameter to CommitUrlCacheEntryA is optional, so check before converting it from Unicode to ANSI.
parent f15287de
......@@ -2494,11 +2494,14 @@ BOOL WINAPI CommitUrlCacheEntryA(
goto cleanup;
MultiByteToWideChar(CP_ACP, 0, lpszUrlName, -1, url_name, len);
len = MultiByteToWideChar(CP_ACP, 0, lpszLocalFileName, -1, NULL, 0);
local_file_name = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
if (!local_file_name)
goto cleanup;
MultiByteToWideChar(CP_ACP, 0, lpszLocalFileName, -1, local_file_name, len);
if (lpszLocalFileName)
{
len = MultiByteToWideChar(CP_ACP, 0, lpszLocalFileName, -1, NULL, 0);
local_file_name = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
if (!local_file_name)
goto cleanup;
MultiByteToWideChar(CP_ACP, 0, lpszLocalFileName, -1, local_file_name, len);
}
if (lpszFileExtension)
{
len = MultiByteToWideChar(CP_ACP, 0, lpszFileExtension, -1, NULL, 0);
......@@ -2522,6 +2525,7 @@ BOOL WINAPI CommitUrlCacheEntryA(
cleanup:
HeapFree(GetProcessHeap(), 0, original_url);
HeapFree(GetProcessHeap(), 0, file_extension);
HeapFree(GetProcessHeap(), 0, local_file_name);
HeapFree(GetProcessHeap(), 0, url_name);
......
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