From 69a0f437db04301252a98de6049c0887a27e40ee Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Tue, 17 Oct 2017 10:23:36 -0700 Subject: [PATCH] examples/nvme/hotplug: free task on error path If the spdk_dma_zmalloc() call for the task buffer fails, we should free the task before returning an error. Change-Id: Icf70826dfc7f921d2a18f340480ea7c2ac3df3f4 Signed-off-by: Daniel Verkamp Reviewed-on: https://review.gerrithub.io/382851 Tested-by: SPDK Automated Test System Reviewed-by: Jim Harris --- examples/nvme/hotplug/hotplug.c | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/nvme/hotplug/hotplug.c b/examples/nvme/hotplug/hotplug.c index 5b16279a6..5d76a9128 100644 --- a/examples/nvme/hotplug/hotplug.c +++ b/examples/nvme/hotplug/hotplug.c @@ -151,6 +151,7 @@ alloc_task(struct dev_ctx *dev) task->buf = spdk_dma_zmalloc(g_io_size_bytes, 0x200, NULL); if (task->buf == NULL) { + free(task); return NULL; }