Alex Henrie : setupapi/tests: Use CRT allocation functions.
Module: wine Branch: master Commit: eea358e6cbe8e9ee5c0b211d42bd7fe2a13449d9 URL: https://gitlab.winehq.org/wine/wine/-/commit/eea358e6cbe8e9ee5c0b211d42bd7fe... Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Sat Nov 4 20:54:49 2023 -0700 setupapi/tests: Use CRT allocation functions. --- dlls/setupapi/tests/devinst.c | 5 ++--- dlls/setupapi/tests/install.c | 6 +++--- dlls/setupapi/tests/misc.c | 8 ++++---- dlls/setupapi/tests/query.c | 18 +++++++++--------- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c index be0831f6882..2dc891d61f1 100644 --- a/dlls/setupapi/tests/devinst.c +++ b/dlls/setupapi/tests/devinst.c @@ -33,7 +33,6 @@ #include "cfgmgr32.h" #include "cguid.h" -#include "wine/heap.h" #include "wine/test.h" /* This is a unique guid for testing purposes */ @@ -1233,7 +1232,7 @@ static void test_device_iface_detail(void) expected_size = FIELD_OFFSET(SP_DEVICE_INTERFACE_DETAIL_DATA_A, DevicePath[strlen(path) + 1]); ok(size == expected_size, "Expected size %lu, got %lu.\n", expected_size, size); - detail = heap_alloc(size * 2); + detail = malloc(size * 2); detail->cbSize = 0; SetLastError(0xdeadbeef); @@ -1283,7 +1282,7 @@ static void test_device_iface_detail(void) ok(size == expected_size, "Expected size %lu, got %lu.\n", expected_size, size); ok(IsEqualGUID(&device.ClassGuid, &guid), "Got unexpected class %s.\n", wine_dbgstr_guid(&device.ClassGuid)); - heap_free(detail); + free(detail); SetupDiDestroyDeviceInfoList(set); } diff --git a/dlls/setupapi/tests/install.c b/dlls/setupapi/tests/install.c index 318f1294210..d33925f128e 100644 --- a/dlls/setupapi/tests/install.c +++ b/dlls/setupapi/tests/install.c @@ -207,17 +207,17 @@ static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv) { LPSTR tempname; - tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH); + tempname = malloc(MAX_PATH); GetTempFileNameA(".", "xx", 0, tempname); if (tempname && (strlen(tempname) < (unsigned)cbTempName)) { lstrcpyA(pszTempName, tempname); - HeapFree(GetProcessHeap(), 0, tempname); + free(tempname); return TRUE; } - HeapFree(GetProcessHeap(), 0, tempname); + free(tempname); return FALSE; } diff --git a/dlls/setupapi/tests/misc.c b/dlls/setupapi/tests/misc.c index b9eb3e6c75f..6fda69f9e39 100644 --- a/dlls/setupapi/tests/misc.c +++ b/dlls/setupapi/tests/misc.c @@ -109,7 +109,7 @@ static void test_original_file_name(LPCSTR original, LPCSTR dest) res = SetupGetInfInformationA(hinf, INFINFO_INF_SPEC_IS_HINF, NULL, 0, &size); ok(res, "SetupGetInfInformation failed with error %ld\n", GetLastError()); - pspii = HeapAlloc(GetProcessHeap(), 0, size); + pspii = malloc(size); res = SetupGetInfInformationA(hinf, INFINFO_INF_SPEC_IS_HINF, pspii, size, NULL); ok(res, "SetupGetInfInformation failed with error %ld\n", GetLastError()); @@ -125,7 +125,7 @@ static void test_original_file_name(LPCSTR original, LPCSTR dest) ok(!spofi.OriginalCatalogName[0], "spofi.OriginalCatalogName should have been \"\" instead of \"%s\"\n", spofi.OriginalCatalogName); ok(!strcmp(original, spofi.OriginalInfName), "spofi.OriginalInfName of %s didn't match real original name %s\n", spofi.OriginalInfName, original); - HeapFree(GetProcessHeap(), 0, pspii); + free(pspii); SetupCloseInfFile(hinf); } @@ -371,12 +371,12 @@ static BOOL compare_file_data(LPSTR file, const BYTE *data, DWORD size) LPBYTE buffer; handle = CreateFileA(file, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - buffer = HeapAlloc(GetProcessHeap(), 0, size); + buffer = malloc(size); if (buffer) { ReadFile(handle, buffer, size, &read, NULL); if (read == size && !memcmp(data, buffer, size)) ret = TRUE; - HeapFree(GetProcessHeap(), 0, buffer); + free(buffer); } CloseHandle(handle); return ret; diff --git a/dlls/setupapi/tests/query.c b/dlls/setupapi/tests/query.c index 6258727c076..f7aeba41153 100644 --- a/dlls/setupapi/tests/query.c +++ b/dlls/setupapi/tests/query.c @@ -120,7 +120,7 @@ static BOOL check_info_filename(PSP_INF_INFORMATION info, LPSTR test) if (!SetupQueryInfFileInformationA(info, 0, NULL, 0, &size)) return FALSE; - filename = HeapAlloc(GetProcessHeap(), 0, size); + filename = malloc(size); if (!filename) return FALSE; @@ -129,7 +129,7 @@ static BOOL check_info_filename(PSP_INF_INFORMATION info, LPSTR test) if (!lstrcmpiA(test, filename)) ret = TRUE; - HeapFree(GetProcessHeap(), 0, filename); + free(filename); return ret; } @@ -142,7 +142,7 @@ static PSP_INF_INFORMATION alloc_inf_info(LPCSTR filename, DWORD search, PDWORD if (!ret) return NULL; - info = HeapAlloc(GetProcessHeap(), 0, *size); + info = malloc(*size); return info; } @@ -234,7 +234,7 @@ static void test_SetupGetInfInformation(void) ret = SetupGetInfInformationA(inf_filename, INFINFO_INF_NAME_IS_ABSOLUTE, NULL, size, NULL); ok(ret == FALSE, "Expected SetupGetInfInformation to fail\n"); - info = HeapAlloc(GetProcessHeap(), 0, size); + info = malloc(size); /* try valid ReturnBuffer but too small size */ SetLastError(0xbeefcafe); @@ -248,7 +248,7 @@ static void test_SetupGetInfInformation(void) ok(ret == TRUE, "Expected SetupGetInfInformation to succeed\n"); ok(check_info_filename(info, inf_filename), "Expected returned filename to be equal\n"); - HeapFree(GetProcessHeap(), 0, info); + free(info); /* try the INFINFO_INF_SPEC_IS_HINF search flag */ hinf = SetupOpenInfFileA(inf_filename, NULL, INF_STYLE_WIN4, NULL); @@ -269,7 +269,7 @@ static void test_SetupGetInfInformation(void) } ok(ret, "can't create inf file %lu\n", GetLastError()); - HeapFree(GetProcessHeap(), 0, info); + free(info); info = alloc_inf_info("test.inf", INFINFO_DEFAULT_SEARCH, &size); /* check if system32 is searched for inf */ @@ -284,7 +284,7 @@ static void test_SetupGetInfInformation(void) lstrcatA(inf_one, "test.inf"); create_inf_file(inf_one, inf_data1, sizeof(inf_data1) - 1); - HeapFree(GetProcessHeap(), 0, info); + free(info); info = alloc_inf_info("test.inf", INFINFO_DEFAULT_SEARCH, &size); /* test the INFINFO_DEFAULT_SEARCH search flag */ @@ -292,7 +292,7 @@ static void test_SetupGetInfInformation(void) ok(ret == TRUE, "Expected SetupGetInfInformation to succeed: %ld\n", GetLastError()); ok(check_info_filename(info, inf_one), "Expected returned filename to be equal\n"); - HeapFree(GetProcessHeap(), 0, info); + free(info); info = alloc_inf_info("test.inf", INFINFO_REVERSE_DEFAULT_SEARCH, &size); /* test the INFINFO_REVERSE_DEFAULT_SEARCH search flag */ @@ -301,7 +301,7 @@ static void test_SetupGetInfInformation(void) ok(check_info_filename(info, revfile), "Expected returned filename to be equal\n"); done: - HeapFree(GetProcessHeap(), 0, info); + free(info); DeleteFileA(inf_filename); DeleteFileA(inf_one); DeleteFileA(inf_two);
participants (1)
-
Alexandre Julliard