[PATCH v1 4/7] erofs-utils: lib: Check for error from z_erofs_pack_file_from_fd()
Sandeep Dhavale
dhavale at google.com
Thu Sep 14 08:11:01 AEST 2023
If z_erofs_pack_file_from_fd() fails, take the error path to free up the
allocated resources.
Signed-off-by: Sandeep Dhavale <dhavale at google.com>
---
lib/compress.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/compress.c b/lib/compress.c
index 8c79418..81f277a 100644
--- a/lib/compress.c
+++ b/lib/compress.c
@@ -927,6 +927,8 @@ int erofs_write_compressed_file(struct erofs_inode *inode, int fd)
if (cfg.c_all_fragments && !erofs_is_packed_inode(inode) &&
!inode->fragment_size) {
ret = z_erofs_pack_file_from_fd(inode, fd, ctx.tof_chksum);
+ if (ret)
+ goto err_free_idata;
} else {
while (ctx.remaining) {
const u64 rx = min_t(u64, ctx.remaining,
--
2.42.0.283.g2d96d420d3-goog
More information about the Linux-erofs
mailing list