Hi all, I think I found a memory-leak problem of e2fsprofgs while using valgrind to testing a tool. 'log.txt' is the output. It is a simple problem. I wrote a patch, and it works on my server. Thanks Li Xi
[root@mds01 mmp]# valgrind --leak-check=full ./mmpstatus /dev/sd ==19790== Memcheck, a memory error detector. ==19790== Copyright (C) 2002-2006, and GNU GPL'd, by Julian Seward et al. ==19790== Using LibVEX rev 1658, a library for dynamic binary translation. ==19790== Copyright (C) 2004-2006, and GNU GPL'd, by OpenWorks LLP. ==19790== Using valgrind-3.2.1, a dynamic binary instrumentation framework. ==19790== Copyright (C) 2000-2006, and GNU GPL'd, by Julian Seward et al. ==19790== For more details, rerun with: -v ==19790== ERROR: mmpstatus.c(280) main(): failed to open filesystem [/dev/sd], ret = 2 ==19790== ==19790== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 5 from 1) ==19790== malloc/free: in use at exit: 8 bytes in 1 blocks. ==19790== malloc/free: 5 allocs, 4 frees, 760 bytes allocated. ==19790== For counts of detected errors, rerun with: -v ==19790== searching for pointers to 1 not-freed blocks. ==19790== checked 100,712 bytes. ==19790== ==19790== 8 bytes in 1 blocks are definitely lost in loss record 1 of 1 ==19790== at 0x4A05809: malloc (vg_replace_malloc.c:149) ==19790== by 0x4C498FC: unix_open (ext2fs.h:1502) ==19790== by 0x4C3F30B: ext2fs_open2 (openfs.c:139) ==19790== by 0x4C3FA18: ext2fs_open (openfs.c:75) ==19790== by 0x40116C: main (in /home/lixi/mmp/mmpstatus) ==19790== ==19790== LEAK SUMMARY: ==19790== definitely lost: 8 bytes in 1 blocks. ==19790== possibly lost: 0 bytes in 0 blocks. ==19790== still reachable: 0 bytes in 0 blocks. ==19790== suppressed: 0 bytes in 0 blocks. ==19790== Reachable blocks (those to which a pointer was found) are not shown. ==19790== To see them, rerun with: --show-reachable=yes
Attachment:
bug_unix_open_memleak_e2fsprogs-1.42.6.patch
Description: Binary data