From: Darrick J. Wong Date: Mon, 5 Feb 2018 20:37:42 +0000 (-0600) Subject: xfs_scrub: close dir_fd if we don't get a DIR pointer X-Git-Tag: v4.15.0-rc1~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e91c285f92cc1028f17833f9773ddc5c9905c804;p=thirdparty%2Fxfsprogs-dev.git xfs_scrub: close dir_fd if we don't get a DIR pointer If we don't get a directory pointer, close dir_fd before jumping out. Fixes-coverity-id: 1428799 Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen Signed-off-by: Eric Sandeen --- diff --git a/scrub/vfs.c b/scrub/vfs.c index e3c8e62c6..573a2d0dc 100644 --- a/scrub/vfs.c +++ b/scrub/vfs.c @@ -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);