test: check valid pointer in spdk_zmalloc before assigning value
Change-Id: I05f70a7aec000e57d20d56cf272bd39e64d5bcc8 Signed-off-by: GangCao <gang.cao@intel.com>
This commit is contained in:
parent
39512fde74
commit
9a1d4a00cc
@ -45,7 +45,9 @@ spdk_zmalloc(size_t size, size_t align, uint64_t *phys_addr)
|
|||||||
if (posix_memalign(&buf, align, size)) {
|
if (posix_memalign(&buf, align, size)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
*phys_addr = (uint64_t)buf;
|
if (phys_addr) {
|
||||||
|
*phys_addr = (uint64_t)buf;
|
||||||
|
}
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user