On 2023/11/4 14:50, Yifan Zhao wrote:
Valgrind reports 2 potential memory leaks in mkfs:

     Command: mkfs.erofs -zlz4 test.img testdir/

     4 bytes in 1 blocks are still reachable in loss record 1 of 2
        at 0x4841848: malloc (vg_replace_malloc.c:431)
        by 0x49633DE: strdup (strdup.c:42)
        by 0x10C483: mkfs_parse_compress_algs (main.c:287)
        by 0x10C483: mkfs_parse_options_cfg (main.c:316)
        by 0x10C483: main (main.c:936)

     34 bytes in 1 blocks are still reachable in loss record 2 of 2
        at 0x4841848: malloc (vg_replace_malloc.c:431)
        by 0x49633DE: strdup (strdup.c:42)
        by 0x48FFE2B: realpath_stk (canonicalize.c:409)
        by 0x48FFE2B: realpath@@GLIBC_2.3 (canonicalize.c:431)
        by 0x10B7EB: mkfs_parse_options_cfg (main.c:587)
        by 0x10B7EB: main (main.c:936)

Fix it by freeing the memory allocated by strdup() and realpath().

Signed-off-by: Yifan Zhao <[email protected]>

Reviewed-by: Gao Xiang <[email protected]>

BTW, would you mind adding a configuration to enable Valgrind?

Thanks,
Gao Xiang

Reply via email to