From: Tobin Harding Date: Tue, 17 Oct 2017 16:37:50 +0000 (+1100) Subject: Fix coverity defects: CID 161388 X-Git-Tag: zfs-0.8.0-rc1~514 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c721ba435fc7d2fb61a6e586c5cc11c27f67b480;p=zfs 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 Signed-off-by: Tobin C. Harding Closes #6755 --- 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)