[PATCH 3/3] erofs-utils: lib: fix fd leak on failure in erofs_dev_open()
Gao Xiang
hsiangkao at linux.alibaba.com
Fri Aug 2 11:55:27 AEST 2024
Coverity-id: 502356
Signed-off-by: Gao Xiang <hsiangkao at linux.alibaba.com>
---
lib/io.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/io.c b/lib/io.c
index 4937db5..6bfae69 100644
--- a/lib/io.c
+++ b/lib/io.c
@@ -258,8 +258,10 @@ repeat:
#if defined(HAVE_SYS_STATFS_H) && defined(HAVE_FSTATFS)
struct statfs stfs;
- if (again)
+ if (again) {
+ close(fd);
return -ENOTEMPTY;
+ }
/*
* fses like EXT4 and BTRFS will flush dirty blocks
--
2.43.5
More information about the Linux-erofs
mailing list