]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_spaceman: close open file for error case in openfile()
authorBill O'Donnell <billodo@redhat.com>
Thu, 29 Jun 2017 18:05:58 +0000 (13:05 -0500)
committerEric Sandeen <sandeen@redhat.com>
Thu, 29 Jun 2017 18:05:58 +0000 (13:05 -0500)
openfile() fails to close the open file in one error case.
Add close(fd) to correct the condition.

Addresses-Coverity-Id: 1413770

Signed-off-by: Bill O'Donnell <billodo@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
spaceman/file.c

index 4ab3090072ad7bdf6b8f7f06177a192242a79348..4c13b4a87033e7cf6e93198579c381947800fc97 100644 (file)
@@ -79,6 +79,7 @@ openfile(
                if (!fsp) {
                        fprintf(stderr, _("%s: cannot find mount point."),
                                path);
+                       close(fd);
                        return -1;
                }
                memcpy(fs_path, fsp, sizeof(struct fs_path));