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:
parent
16a45d2591
commit
e73007a63a
@ -784,10 +784,13 @@ associate_workers_with_ns(void)
|
|||||||
#ifdef HAVE_LIBAIO
|
#ifdef HAVE_LIBAIO
|
||||||
ns_ctx->events = calloc(g_queue_depth, sizeof(struct io_event));
|
ns_ctx->events = calloc(g_queue_depth, sizeof(struct io_event));
|
||||||
if (!ns_ctx->events) {
|
if (!ns_ctx->events) {
|
||||||
|
free(ns_ctx);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ns_ctx->ctx = 0;
|
ns_ctx->ctx = 0;
|
||||||
if (io_setup(g_queue_depth, &ns_ctx->ctx) < 0) {
|
if (io_setup(g_queue_depth, &ns_ctx->ctx) < 0) {
|
||||||
|
free(ns_ctx->events);
|
||||||
|
free(ns_ctx);
|
||||||
perror("io_setup");
|
perror("io_setup");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user