perf: Fix memory leak when IO submit failed

When submit_io cb returns bad status, current
task is dropped and allocated memory is not cleaned.

Change-Id: Ibc33e76e6800644c29eaeb826a3401ad5d5fd582
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7376
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Alexey Marchuk 2021-04-14 18:25:24 +03:00 committed by Tomasz Zawadzki
parent 364ad5aedc
commit a6b92896ff

View File

@ -1378,6 +1378,10 @@ submit_single_io(struct perf_task *task)
if (spdk_unlikely(rc != 0)) {
RATELIMIT_LOG("starting I/O failed\n");
spdk_dma_free(task->iovs[0].iov_base);
free(task->iovs);
spdk_dma_free(task->md_iov.iov_base);
free(task);
} else {
ns_ctx->current_queue_depth++;
}