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 <behlendorf1@llnl.gov>
Signed-off-by: Tobin C. Harding <me@tobin.cc>
Closes #6755
This commit is contained in:
Tobin Harding 2017-10-18 03:37:50 +11:00 committed by Brian Behlendorf
parent ced28193b0
commit c721ba435f
1 changed files with 4 additions and 2 deletions

View 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)