Commit 9cedc720 authored by GangCao's avatar GangCao Committed by Tomasz Zawadzki
Browse files

Util: check the error case of NULL pointer



Change-Id: I0be36b584c99de822920b935c34708576617ffc3
Signed-off-by: default avatarGangCao <gang.cao@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8176


Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarXiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatar <dongx.yi@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent 5a21edf4
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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));