]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
wipefs: fix FD leak on error [coverity scan]
authorKarel Zak <kzak@redhat.com>
Thu, 29 Jan 2015 11:40:06 +0000 (12:40 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 29 Jan 2015 11:42:58 +0000 (12:42 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/wipefs.c

index 0daa87ae9445fbfc0b74d25899834b3fb4e4d579..589f535038470aa3412541c30cdf918e100ef3c6 100644 (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 *