[PATCH] xfs_spaceman: close open file for error case in openfile()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



openfile() fails to close the open file in one error case.
Add close(fd) to correct the condition.

Detected by CoverityScan, CID#1413770 (RESOURCE_LEAK)

Signed-off-by: Bill O'Donnell <billodo@xxxxxxxxxx>
---
 spaceman/file.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/spaceman/file.c b/spaceman/file.c
index 4ab30900..4c13b4a8 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));
-- 
2.13.0

--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux