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:
GangCao 2016-10-13 22:58:19 -04:00 committed by Jim Harris
parent 39512fde74
commit 9a1d4a00cc

View File

@ -45,7 +45,9 @@ spdk_zmalloc(size_t size, size_t align, uint64_t *phys_addr)
if (posix_memalign(&buf, align, size)) {
return NULL;
}
*phys_addr = (uint64_t)buf;
if (phys_addr) {
*phys_addr = (uint64_t)buf;
}
return buf;
}