bdev/ocf: fix possible memory leak in ctx_data_alloc

Signed-off-by: Amir Haroush <amir.haroush@huawei.com>
Signed-off-by: Shai Fultheim <shai.fultheim@huawei.com>
Change-Id: I8b33e62bd6e0f297e6fc325942c501100855fd6c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17939
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Community-CI: Mellanox Build Bot
This commit is contained in:
Amir Haroush 2023-05-04 16:23:06 +03:00 committed by Konrad Sztyber
parent 559a97aa7c
commit 9c274912d0

View File

@ -22,11 +22,15 @@ vbdev_ocf_ctx_data_alloc(uint32_t pages)
uint32_t sz;
data = vbdev_ocf_data_alloc(1);
if (data == NULL) {
return NULL;
}
sz = pages * PAGE_SIZE;
buf = spdk_malloc(sz, PAGE_SIZE, NULL,
SPDK_ENV_LCORE_ID_ANY, SPDK_MALLOC_DMA);
if (buf == NULL) {
vbdev_ocf_data_free(data);
return NULL;
}