From f81ccf1cc4a837fbc101be8b110717e76a250a97 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Mon, 26 Jun 2017 11:39:06 -0700 Subject: [PATCH] ndctl, check-namespace: fix resource leak Static analysis points out that we leak 'bttc' in namespace_check(). Cc: Vishal Verma Signed-off-by: Dan Williams --- ndctl/check.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ndctl/check.c b/ndctl/check.c index 3775c2ed..2d913cf5 100644 --- a/ndctl/check.c +++ b/ndctl/check.c @@ -898,7 +898,8 @@ int namespace_check(struct ndctl_namespace *ndns, struct check_opts *opts) if (sigaction(SIGBUS, &act, 0)) { err(bttc, "Unable to set sigaction\n"); - return -errno; + rc = -errno; + goto out_bttc; } bttc->opts = opts; @@ -912,7 +913,7 @@ int namespace_check(struct ndctl_namespace *ndns, struct check_opts *opts) if (opts->force) { rc = ndctl_namespace_disable_safe(ndns); if (rc) - return rc; + goto out_bttc; disabled_flag = 1; } else { err(bttc, "%s: check aborted, namespace online\n",