Skip to content

Commit 99a7f0c

Browse files
committed
Fix null pointer dereference in createDevDaxParams()
Fix null pointer dereference in createDevDaxParams(). It fixes the Coverity issue no. 485528. Signed-off-by: Lukasz Dorau <[email protected]>
1 parent 3d836a7 commit 99a7f0c

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

test/pools/jemalloc_coarse_devdax.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ bool devDaxEnvSet() {
2020
void *createDevDaxParams() {
2121
char *path = getenv("UMF_TESTS_DEVDAX_PATH");
2222
char *size = getenv("UMF_TESTS_DEVDAX_SIZE");
23+
if (path == nullptr || path[0] == 0 || size == nullptr || size[0] == 0) {
24+
return nullptr;
25+
}
2326

2427
umf_devdax_memory_provider_params_handle_t params = NULL;
2528
umf_result_t res =

test/pools/scalable_coarse_devdax.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ bool devDaxEnvSet() {
2020
void *createDevDaxParams() {
2121
char *path = getenv("UMF_TESTS_DEVDAX_PATH");
2222
char *size = getenv("UMF_TESTS_DEVDAX_SIZE");
23+
if (path == nullptr || path[0] == 0 || size == nullptr || size[0] == 0) {
24+
return nullptr;
25+
}
2326

2427
umf_devdax_memory_provider_params_handle_t params = NULL;
2528
umf_result_t res =

0 commit comments

Comments
 (0)