Skip to contentSkip to conversation

erofs-utils: mkfs: fix memory leak from small fragments

PATCH New Gao Xiang 1 participant 1 message Jun 25, 2025 Library code

lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

PATCH 1/1 erofs-utils: mkfs: fix memory leak from small fragments

Fix memory leak for fragments smaller than EROFS_TOF_HASHLEN.

Fixes 84bae6acdbee ("erofs-utils: lib: keep full data until the fragment is committed")
---
 lib/fragments.c | 2 ++
 1 file changed, 2 insertions(+)
lib/fragments.c +2 -0
index 83fd821..6111631 100644
@@ -365,6 +365,8 @@ int erofs_fragment_commit(struct erofs_inode *inode, u32 tofh)
 		return 0;
 	}
 	inode->fragmentoff = (erofs_off_t)offset - len;
+	inode->fragment = NULL;
+	free(fi->data);
 	free(fi);
 	return 0;
 }
Signature · 1 line
2.43.5