wininet: Use GlobalAlloc in InternetQueryOption(INTERNET_OPTION_PER_CONNECTION_OPTION).

So the allocator matches with documentation.
This commit is contained in:
Piotr Caban 2024-02-15 13:55:28 +01:00 committed by Alexandre Julliard
parent 7dcdfd7bf2
commit 9ea0a1072d
2 changed files with 7 additions and 5 deletions

View file

@ -2606,7 +2606,7 @@ static WCHAR *copy_optionW(WCHAR *value)
return NULL;
len = (wcslen(value) + 1) * sizeof(WCHAR);
if (!(tmp = HeapAlloc(GetProcessHeap(), 0, len)))
if (!(tmp = GlobalAlloc(0, len)))
return NULL;
return memcpy(tmp, value, len);
@ -2621,7 +2621,7 @@ static char *copy_optionA(WCHAR *value)
return NULL;
len = WideCharToMultiByte(CP_ACP, 0, value, -1, NULL, 0, NULL, NULL);
if (!(tmp = HeapAlloc(GetProcessHeap(), 0, len)))
if (!(tmp = GlobalAlloc(0, len)))
return NULL;
WideCharToMultiByte(CP_ACP, 0, value, -1, tmp, len, NULL, NULL);

View file

@ -1317,7 +1317,7 @@ static void test_Option_PerConnectionOption(void)
ret = HeapValidate(GetProcessHeap(), 0, list.pOptions[0].Value.pszValue);
ok(ret, "HeapValidate failed, last error %lu\n", GetLastError());
HeapFree(GetProcessHeap(), 0, list.pOptions[0].Value.pszValue);
GlobalFree(list.pOptions[0].Value.pszValue);
HeapFree(GetProcessHeap(), 0, list.pOptions);
/* disable the proxy server */
@ -1381,6 +1381,7 @@ static void test_Option_PerConnectionOption(void)
ret = InternetSetOptionW(ses, INTERNET_OPTION_PER_CONNECTION_OPTION, &list, size);
ok(ret == TRUE, "InternetSetOption should've succeeded\n");
GlobalFree(list.pOptions[0].Value.pszValue);
HeapFree(GetProcessHeap(), 0, list.pOptions);
InternetCloseHandle(ses);
@ -1443,7 +1444,7 @@ static void test_Option_PerConnectionOptionA(void)
"Retrieved flags should've been PROXY_TYPE_PROXY, was: %ld\n",
list.pOptions[1].Value.dwValue);
HeapFree(GetProcessHeap(), 0, list.pOptions[0].Value.pszValue);
GlobalFree(list.pOptions[0].Value.pszValue);
HeapFree(GetProcessHeap(), 0, list.pOptions);
/* test with NULL as proxy server */
@ -1469,7 +1470,7 @@ static void test_Option_PerConnectionOptionA(void)
"Retrieved proxy server should've been NULL, was: \"%s\"\n",
list.pOptions[0].Value.pszValue);
HeapFree(GetProcessHeap(), 0, list.pOptions[0].Value.pszValue);
GlobalFree(list.pOptions[0].Value.pszValue);
HeapFree(GetProcessHeap(), 0, list.pOptions);
/* restore original settings */
@ -1480,6 +1481,7 @@ static void test_Option_PerConnectionOptionA(void)
&list, size);
ok(ret == TRUE, "InternetSetOption should've succeeded\n");
GlobalFree(list.pOptions[0].Value.pszValue);
HeapFree(GetProcessHeap(), 0, list.pOptions);
InternetCloseHandle(ses);