Skip to content

Commit 7946195

Browse files
committed
use freed pointer for testing getAllocInfo
1 parent d6861c5 commit 7946195

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

test/acl_usm_test.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -425,20 +425,21 @@ MT_TEST(acl_usm, buffer_location_usm) {
425425
CHECK_EQUAL(CL_SUCCESS, status);
426426
CHECK_EQUAL(0, read_mem_id);
427427
CHECK_EQUAL(sizeof(cl_uint), ret_size);
428-
// Check when given pointer is invalid
429-
status = clGetMemAllocInfoINTEL(m_context, NULL,
428+
429+
status = clMemFreeINTEL(m_context, test_ptr);
430+
ACL_LOCKED(CHECK_EQUAL(acl_usm_ptr_belongs_to_context(m_context, test_ptr),
431+
CL_FALSE));
432+
CHECK(m_context->usm_allocation.empty());
433+
434+
// Check when given pointer is already freed
435+
status = clGetMemAllocInfoINTEL(m_context, test_ptr,
430436
CL_MEM_ALLOC_BUFFER_LOCATION_INTEL,
431437
sizeof(cl_uint), &read_mem_id, &ret_size);
432438

433439
CHECK_EQUAL(CL_SUCCESS, status);
434440
CHECK_EQUAL(0, read_mem_id);
435441
CHECK_EQUAL(sizeof(cl_uint), ret_size);
436-
437-
status = clMemFreeINTEL(m_context, test_ptr);
438442
CHECK_EQUAL(status, CL_SUCCESS);
439-
ACL_LOCKED(CHECK_EQUAL(acl_usm_ptr_belongs_to_context(m_context, test_ptr),
440-
CL_FALSE));
441-
CHECK(m_context->usm_allocation.empty());
442443

443444
ACL_LOCKED(acl_print_debug_msg("end buffer_location_usm\n"));
444445
}

0 commit comments

Comments
 (0)