aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorTobin Harding <[email protected]>2017-10-18 03:37:50 +1100
committerBrian Behlendorf <[email protected]>2017-10-17 09:37:50 -0700
commitc721ba435fc7d2fb61a6e586c5cc11c27f67b480 (patch)
treef49cd3ddb70f29d979b9bf3975397b46e7449363 /cmd
parentced28193b06b3d93f404a5d67713c124731a2a0d (diff)
Fix coverity defects: CID 161388
CID 161388: Resource Leak (REASOURCE_LEAK) Jump to errout so that file descriptor gets closed before returning from function. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Tobin C. Harding <[email protected]> Closes #6755
Diffstat (limited to 'cmd')
-rw-r--r--cmd/zpool/zpool_main.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c
index c61639cc2..db2486aee 100644
--- a/cmd/zpool/zpool_main.c
+++ b/cmd/zpool/zpool_main.c
@@ -897,7 +897,8 @@ zpool_do_labelclear(int argc, char **argv)
if (zpool_read_label(fd, &config, NULL) != 0 || config == NULL) {
(void) fprintf(stderr,
gettext("failed to check state for %s\n"), vdev);
- return (1);
+ ret = 1;
+ goto errout;
}
nvlist_free(config);
@@ -905,7 +906,8 @@ zpool_do_labelclear(int argc, char **argv)
if (ret != 0) {
(void) fprintf(stderr,
gettext("failed to check state for %s\n"), vdev);
- return (1);
+ ret = 1;
+ goto errout;
}
if (!inuse)