]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Fix coverity defects: CID 161388
authorTobin Harding <me@tobin.cc>
Tue, 17 Oct 2017 16:37:50 +0000 (03:37 +1100)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 17 Oct 2017 16:37:50 +0000 (09:37 -0700)
CID 161388: Resource Leak (REASOURCE_LEAK)

Jump to errout so that file descriptor gets closed before returning
from function.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tobin C. Harding <me@tobin.cc>
Closes #6755

cmd/zpool/zpool_main.c

index c61639cc24a77ddad73097ce840f70c0f6ef7ff9..db2486aeebf87cc676c4b589124280f85ebc60e7 100644 (file)
@@ -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)