Util: check the error case of NULL pointer
Change-Id: I0be36b584c99de822920b935c34708576617ffc3 Signed-off-by: GangCao <gang.cao@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8176 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: <dongx.yi@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
5a21edf4e3
commit
9cedc7202c
@ -83,6 +83,12 @@ main(int argc, char **argv)
|
||||
|
||||
zipf = spdk_zipf_create(range, theta, time(NULL));
|
||||
h = spdk_histogram_data_alloc();
|
||||
if (zipf == NULL || h == NULL) {
|
||||
spdk_zipf_free(&zipf);
|
||||
spdk_histogram_data_free(h);
|
||||
printf("out of resource\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
spdk_histogram_data_tally(h, spdk_zipf_generate(zipf));
|
||||
|
Loading…
Reference in New Issue
Block a user