From: Karel Zak Date: Thu, 29 Jan 2015 11:40:06 +0000 (+0100) Subject: wipefs: fix FD leak on error [coverity scan] X-Git-Tag: v2.26-rc2~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f1b64c1c1f20c459077db36797dd5cc7063d8d55;p=thirdparty%2Futil-linux.git wipefs: fix FD leak on error [coverity scan] Signed-off-by: Karel Zak --- diff --git a/misc-utils/wipefs.c b/misc-utils/wipefs.c index 0daa87ae94..589f535038 100644 --- a/misc-utils/wipefs.c +++ b/misc-utils/wipefs.c @@ -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 *