Commit 9c274912 authored by Amir Haroush's avatar Amir Haroush Committed by Konrad Sztyber
Browse files

bdev/ocf: fix possible memory leak in ctx_data_alloc



Signed-off-by: default avatarAmir Haroush <amir.haroush@huawei.com>
Signed-off-by: default avatarShai Fultheim <shai.fultheim@huawei.com>
Change-Id: I8b33e62bd6e0f297e6fc325942c501100855fd6c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17939


Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Community-CI: Mellanox Build Bot
parent 559a97aa
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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;
	}