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 <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-01-11 09:45:40 -07:00
parent 16a45d2591
commit e73007a63a

View File

@ -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;
}