[PATCH 1/3] erofs-utils: fsck: fix fd leak on failure in erofs_extract_file()

Gao Xiang hsiangkao at linux.alibaba.com
Fri Aug 2 11:55:25 AEST 2024


Ignore the return values as other close()s instead.

Coverity-id: 502331
Signed-off-by: Gao Xiang <hsiangkao at linux.alibaba.com>
---
 fsck/main.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fsck/main.c b/fsck/main.c
index fb66967..bbef645 100644
--- a/fsck/main.c
+++ b/fsck/main.c
@@ -702,11 +702,9 @@ again:
 
 	/* verify data chunk layout */
 	ret = erofs_verify_inode_data(inode, fd);
+	close(fd);
 	if (ret)
 		return ret;
-
-	if (close(fd))
-		return -errno;
 	return ret;
 }
 
-- 
2.43.5



More information about the Linux-erofs mailing list