bdevperf: free job->zipf

Currently we do not free the memory allocated
during spdk_zipf_create() call, when we exit
the for loop on line 1769 with error. Remedy
this problem by adding spdk_zipf_free() calls.

Change-Id: I1d593ad2375204b158a2c97b23e492e69f836f43
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17405
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
This commit is contained in:
Krzysztof Karas 2023-03-29 15:44:57 +02:00 committed by Jim Harris
parent 6648ea0fe6
commit 8e8c360b53

View File

@ -1770,6 +1770,7 @@ bdevperf_construct_job(struct spdk_bdev *bdev, struct job_config *config,
task = calloc(1, sizeof(struct bdevperf_task));
if (!task) {
fprintf(stderr, "Failed to allocate task from memory\n");
spdk_zipf_free(&job->zipf);
return -ENOMEM;
}
@ -1777,6 +1778,7 @@ bdevperf_construct_job(struct spdk_bdev *bdev, struct job_config *config,
SPDK_ENV_LCORE_ID_ANY, SPDK_MALLOC_DMA);
if (!task->buf) {
fprintf(stderr, "Cannot allocate buf for task=%p\n", task);
spdk_zipf_free(&job->zipf);
free(task);
return -ENOMEM;
}
@ -1787,6 +1789,7 @@ bdevperf_construct_job(struct spdk_bdev *bdev, struct job_config *config,
SPDK_ENV_LCORE_ID_ANY, SPDK_MALLOC_DMA);
if (!task->md_buf) {
fprintf(stderr, "Cannot allocate md buf for task=%p\n", task);
spdk_zipf_free(&job->zipf);
spdk_free(task->buf);
free(task);
return -ENOMEM;