Skip to content

Commit c77d3a1

Browse files
committed
avoid nullptr deref coverity issue in L0 tests
1 parent 7514d14 commit c77d3a1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

test/common/level_zero_mocks.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ TestCreateMemoryAllocationProperties(uint32_t modifier) {
9999
void MockedLevelZeroTestEnvironment::SetUp() {
100100
const char *lib_name = getenv("UMF_ZE_LOADER_LIB_NAME");
101101
ASSERT_NE(lib_name, nullptr);
102+
if (lib_name == nullptr) {
103+
return; // to avoid nullptr deref coverity issue
104+
}
102105
ASSERT_NE(lib_name[0], '\0');
103106

104107
lib_handle = utils_open_library(lib_name, 0);

0 commit comments

Comments
 (0)