From 8e8c360b530dc761277e26a6548153d1169f1c8f Mon Sep 17 00:00:00 2001 From: Krzysztof Karas Date: Wed, 29 Mar 2023 15:44:57 +0200 Subject: [PATCH] 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 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17405 Reviewed-by: Jim Harris Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Aleksey Marchuk --- examples/bdev/bdevperf/bdevperf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/bdev/bdevperf/bdevperf.c b/examples/bdev/bdevperf/bdevperf.c index dff70408c..0f916f5a6 100644 --- a/examples/bdev/bdevperf/bdevperf.c +++ b/examples/bdev/bdevperf/bdevperf.c @@ -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;