From: Bill O'Donnell Date: Thu, 29 Jun 2017 18:05:58 +0000 (-0500) Subject: xfs_spaceman: close open file for error case in openfile() X-Git-Tag: v4.12.0-rc1~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1cda90906c093d30911c0a20f214d68a1d220cdd;p=thirdparty%2Fxfsprogs-dev.git xfs_spaceman: close open file for error case in openfile() 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 Reviewed-by: Darrick J. Wong Signed-off-by: Eric Sandeen --- diff --git a/spaceman/file.c b/spaceman/file.c index 4ab309007..4c13b4a87 100644 --- a/spaceman/file.c +++ b/spaceman/file.c @@ -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));