[PATCH] erofs-utils: fix a memory leak of compressmeta

Gao Xiang hsiangkao at aol.com
Sun Aug 25 13:36:38 AEST 2019


compressmeta should be freed after successfully written.

Signed-off-by: Gao Xiang <hsiangkao at aol.com>
---
 lib/inode.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/inode.c b/lib/inode.c
index 581f263..141a300 100644
--- a/lib/inode.c
+++ b/lib/inode.c
@@ -404,6 +404,7 @@ static bool erofs_bh_flush_write_inode(struct erofs_buffer_head *bh)
 		ret = dev_write(inode->compressmeta, off, inode->extent_isize);
 		if (ret)
 			return false;
+		free(inode->compressmeta);
 	}
 
 	inode->bh = NULL;
-- 
2.17.1



More information about the Linux-erofs mailing list