Skip to contentSkip to conversation

erofs-utils: lib: fix NULL dereference

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

lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

PATCH 1/1 erofs-utils: lib: fix NULL dereference

Coverity-id: 555136

Fixes 84bae6acdbee ("erofs-utils: lib: keep full data until the fragment is committed")
---
 lib/fragments.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/fragments.c +1 -1
index d63995e..0784a82 100644
@@ -311,7 +311,7 @@ int erofs_pack_file_from_fd(struct erofs_inode *inode, int fd, u32 tofh)
 out:
 	if (onheap)
 		free(memblock);
-	else
+	else if (memblock)
 		munmap(memblock, inode->i_size);
 	return rc;
 }
Signature · 1 line
2.43.5