wipefs: fix FD leak on error [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2015-01-29 12:40:06 +01:00
parent 1539750f2a
commit f1b64c1c1f
1 changed files with 1 additions and 2 deletions

View File

@ -240,7 +240,7 @@ new_probe(const char *devname, int mode)
goto error;
pr = blkid_new_probe();
if (pr && blkid_probe_set_device(pr, fd, 0, 0)) {
if (!pr || blkid_probe_set_device(pr, fd, 0, 0) != 0) {
close(fd);
goto error;
}
@ -266,7 +266,6 @@ new_probe(const char *devname, int mode)
error:
blkid_free_probe(pr);
err(EXIT_FAILURE, _("error: %s: probing initialization failed"), devname);
return NULL;
}
static struct wipe_desc *