]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_scrub: close dir_fd if we don't get a DIR pointer
authorDarrick J. Wong <darrick.wong@oracle.com>
Mon, 5 Feb 2018 20:37:42 +0000 (14:37 -0600)
committerEric Sandeen <sandeen@redhat.com>
Mon, 5 Feb 2018 20:37:42 +0000 (14:37 -0600)
If we don't get a directory pointer, close dir_fd before jumping out.

Fixes-coverity-id: 1428799
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
scrub/vfs.c

index e3c8e62c64666812719c834498123dfd862bf9db..573a2d0dcd104d0c858a1219d3d43ec2276eb19f 100644 (file)
@@ -88,6 +88,7 @@ scan_fs_dir(
        /* Caller-specific directory checks. */
        if (!sft->dir_fn(ctx, sftd->path, dir_fd, sft->arg)) {
                sft->moveon = false;
+               close(dir_fd);
                goto out;
        }
 
@@ -95,6 +96,7 @@ scan_fs_dir(
        dir = fdopendir(dir_fd);
        if (!dir) {
                str_errno(ctx, sftd->path);
+               close(dir_fd);
                goto out;
        }
        rewinddir(dir);