From e73007a63a04f8fb861f8027b235d3c21e98aa43 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Mon, 11 Jan 2016 09:45:40 -0700 Subject: [PATCH] nvme/perf: fix memory leaks on error conditions This doesn't really matter, since the program will be exiting immediately if associate_workers_with_ns() fails, but it makes static analyzers happy. Change-Id: Ic21d234dec50bd2b6684b5fe2caa78d616f93052 Signed-off-by: Daniel Verkamp --- examples/nvme/perf/perf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/nvme/perf/perf.c b/examples/nvme/perf/perf.c index 07dd6a764..66767d834 100644 --- a/examples/nvme/perf/perf.c +++ b/examples/nvme/perf/perf.c @@ -784,10 +784,13 @@ associate_workers_with_ns(void) #ifdef HAVE_LIBAIO ns_ctx->events = calloc(g_queue_depth, sizeof(struct io_event)); if (!ns_ctx->events) { + free(ns_ctx); return -1; } ns_ctx->ctx = 0; if (io_setup(g_queue_depth, &ns_ctx->ctx) < 0) { + free(ns_ctx->events); + free(ns_ctx); perror("io_setup"); return -1; }