[LU-12641] Memory leak of check_if_lustre_mounted() of e2fsprogs Created: 08/Aug/19  Updated: 24/Sep/20

Status: Open
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Li Xi Assignee: Li Xi
Resolution: Unresolved Votes: 0
Labels: None

Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

check_if_lustre_mounted() doesn't free the allocated memory if failure:

[root@server17 e2fsprogs_whamcloud.git]# valgrind --leak-check=full /root/lixi/e2fsck/e2fsprogs_whamcloud.git/e2fsck/e2fsck -v -f -tt -n /dev/sdl1 
==25501== Memcheck, a memory error detector
==25501== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==25501== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==25501== Command: /root/lixi/e2fsck/e2fsprogs_whamcloud.git/e2fsck/e2fsck -v -f -tt -n /dev/sdl1
==25501== 
e2fsck 1.45.2.wc1 (27-May-2019)
Cannot resolve path /dev/sdl1
/root/lixi/e2fsck/e2fsprogs_whamcloud.git/e2fsck/e2fsck: No such file or directory while trying to open /dev/sdl1
Possibly non-existent device?
==25501== 
==25501== HEAP SUMMARY:
==25501==     in use at exit: 6,565 bytes in 39 blocks
==25501==   total heap usage: 155 allocs, 116 frees, 28,085 bytes allocated
==25501== 
==25501== 4,096 bytes in 1 blocks are definitely lost in loss record 26 of 26
==25501==    at 0x4C29BC3: malloc (vg_replace_malloc.c:299)
==25501==    by 0x452116: check_if_lustre_mounted (ismounted.c:520)
==25501==    by 0x452116: ext2fs_check_mount_point (ismounted.c:609)
==25501==    by 0x40FC12: check_mount (unix.c:235)
==25501==    by 0x40FC12: main (unix.c:1577)
==25501== 
==25501== LEAK SUMMARY:
==25501==    definitely lost: 4,096 bytes in 1 blocks
==25501==    indirectly lost: 0 bytes in 0 blocks
==25501==      possibly lost: 0 bytes in 0 blocks
==25501==    still reachable: 2,469 bytes in 38 blocks
==25501==         suppressed: 0 bytes in 0 blocks
==25501== Reachable blocks (those to which a pointer was found) are not shown.
==25501== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==25501== 
==25501== For counts of detected and suppressed errors, rerun with: -v
==25501== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
[root@server17 e2fsprogs_whamcloud.git]# valgrind --leak-check=full /root/lixi/e2fsck/e2fsprogs_whamcloud.git/e2fsck/e2fsck -v -f -tt -n /dev/sdl1 ^C


 Comments   
Comment by Gerrit Updater [ 08/Aug/19 ]

Li Xi (lixi@ddn.com) uploaded a new patch: https://review.whamcloud.com/35729
Subject: LU-12641 libext2fs: memory leak of check_if_lustre_mounted
Project: tools/e2fsprogs
Branch: master-lustre
Current Patch Set: 1
Commit: f693e2ec0780d7f84797ca833b70f0d2144146a7

Comment by Gerrit Updater [ 24/Sep/20 ]

Andreas Dilger (adilger@whamcloud.com) merged in patch https://review.whamcloud.com/35729/
Subject: LU-12641 libext2fs: memory leak of check_if_lustre_mounted
Project: tools/e2fsprogs
Branch: master-lustre
Current Patch Set:
Commit: b31bf039cb8d54a6e39e8d1308e8418c7c6413a2

Generated at Sat Feb 10 02:54:22 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.