Module: wine Branch: master Commit: 9ea0a1072dd28cb8f06577384f82991acf7dc690 URL: https://gitlab.winehq.org/wine/wine/-/commit/9ea0a1072dd28cb8f06577384f82991...
Author: Piotr Caban piotr@codeweavers.com Date: Thu Feb 15 13:55:28 2024 +0100
wininet: Use GlobalAlloc in InternetQueryOption(INTERNET_OPTION_PER_CONNECTION_OPTION).
So the allocator matches with documentation.
---
dlls/wininet/internet.c | 4 ++-- dlls/wininet/tests/internet.c | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c index fe11cb6f501..22f0023bba2 100644 --- a/dlls/wininet/internet.c +++ b/dlls/wininet/internet.c @@ -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); diff --git a/dlls/wininet/tests/internet.c b/dlls/wininet/tests/internet.c index 715b03f95fb..32504382477 100644 --- a/dlls/wininet/tests/internet.c +++ b/dlls/wininet/tests/internet.c @@ -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);