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:
parent
ced28193b0
commit
c721ba435f
|
@ -897,7 +897,8 @@ zpool_do_labelclear(int argc, char **argv)
|
||||||
if (zpool_read_label(fd, &config, NULL) != 0 || config == NULL) {
|
if (zpool_read_label(fd, &config, NULL) != 0 || config == NULL) {
|
||||||
(void) fprintf(stderr,
|
(void) fprintf(stderr,
|
||||||
gettext("failed to check state for %s\n"), vdev);
|
gettext("failed to check state for %s\n"), vdev);
|
||||||
return (1);
|
ret = 1;
|
||||||
|
goto errout;
|
||||||
}
|
}
|
||||||
nvlist_free(config);
|
nvlist_free(config);
|
||||||
|
|
||||||
|
@ -905,7 +906,8 @@ zpool_do_labelclear(int argc, char **argv)
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
(void) fprintf(stderr,
|
(void) fprintf(stderr,
|
||||||
gettext("failed to check state for %s\n"), vdev);
|
gettext("failed to check state for %s\n"), vdev);
|
||||||
return (1);
|
ret = 1;
|
||||||
|
goto errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!inuse)
|
if (!inuse)
|
||||||
|
|
Loading…
Reference in New Issue