SWDEV-548500 - Resolve memory leaks in memory tests (#1093)

This commit is contained in:
marandje
2025-10-24 16:27:48 +02:00
committed by GitHub
parent 95f721f8a5
commit 7e20e8ec13
12 changed files with 42 additions and 24 deletions
@@ -189,6 +189,7 @@ TEST_CASE("Unit_hipPointerGetAttribute_BufferID") {
HIP_CHECK(hipPointerGetAttribute(&bufid2, HIP_POINTER_ATTRIBUTE_BUFFER_ID,
reinterpret_cast<hipDeviceptr_t>(A_d)));
REQUIRE(bufid1 != bufid2);
HIP_CHECK(hipFree(A_d));
}
/* Allocate host memory and get the device ordinal by calling
@@ -240,6 +241,7 @@ TEST_CASE("Unit_hipPointerGetAttribute_MappedMem") {
REQUIRE(mallocManaged == 1);
HIP_CHECK(hipFree(A_d));
HIP_CHECK(hipHostFree(ptr1));
HIP_CHECK(hipFree(ptr2));
free(A_h);
}
@@ -276,8 +278,6 @@ TEST_CASE("Unit_hipPointerGetAttribute_Negative") {
reinterpret_cast<hipDeviceptr_t>(B_d)) == hipErrorInvalidValue);
}
SECTION("Get Start address of host pointer") {
char* A_h;
A_h = reinterpret_cast<char*>(malloc(Nbytes));
REQUIRE(hipPointerGetAttribute(&data, HIP_POINTER_ATTRIBUTE_RANGE_START_ADDR,
reinterpret_cast<hipDeviceptr_t>(A_h)) == hipErrorInvalidValue);
}