* [PATCH] btrfs-progs: check: Fix memory leak in check_chunks_and_extents
@ 2017-05-02 3:17 Qu Wenruo
2017-05-02 14:28 ` David Sterba
0 siblings, 1 reply; 2+ messages in thread
From: Qu Wenruo @ 2017-05-02 3:17 UTC (permalink / raw)
To: linux-btrfs, dsterba
fsck/003-shift-offsets makes valgrinds complaining about memory leaks.
==5910==
==5910== HEAP SUMMARY:
==5910== in use at exit: 1,112 bytes in 11 blocks
==5910== total heap usage: 161 allocs, 150 frees, 164,800 bytes allocated
==5910==
==5910== 216 (72 direct, 144 indirect) bytes in 1 blocks are definitely lost in loss record 3 of 5
==5910== at 0x4C2AF1F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==5910== by 0x4815A3: add_root_item_to_list (cmds-check.c:9683)
==5910== by 0x481CE2: check_chunks_and_extents (cmds-check.c:9886)
==5910== by 0x48888B: cmd_check (cmds-check.c:12977)
==5910== by 0x40A8C5: main (btrfs.c:246)
==5910==
The check_chunks_and_extents() memory leaks are caused by not freeing
added root items of normal_trees and dropping_trees.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
---
cmds-check.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/cmds-check.c b/cmds-check.c
index 17b7efbf..897b1587 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -9972,6 +9972,8 @@ out:
free_extent_cache_tree(&pending);
free_extent_cache_tree(&reada);
free_extent_cache_tree(&nodes);
+ free_root_item_list(&normal_trees);
+ free_root_item_list(&dropping_trees);
return ret;
loop:
free_corrupt_blocks_tree(root->fs_info->corrupt_blocks);
--
2.12.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] btrfs-progs: check: Fix memory leak in check_chunks_and_extents
2017-05-02 3:17 [PATCH] btrfs-progs: check: Fix memory leak in check_chunks_and_extents Qu Wenruo
@ 2017-05-02 14:28 ` David Sterba
0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2017-05-02 14:28 UTC (permalink / raw)
To: Qu Wenruo; +Cc: linux-btrfs, dsterba
On Tue, May 02, 2017 at 11:17:25AM +0800, Qu Wenruo wrote:
> fsck/003-shift-offsets makes valgrinds complaining about memory leaks.
> ==5910==
> ==5910== HEAP SUMMARY:
> ==5910== in use at exit: 1,112 bytes in 11 blocks
> ==5910== total heap usage: 161 allocs, 150 frees, 164,800 bytes allocated
> ==5910==
> ==5910== 216 (72 direct, 144 indirect) bytes in 1 blocks are definitely lost in loss record 3 of 5
> ==5910== at 0x4C2AF1F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==5910== by 0x4815A3: add_root_item_to_list (cmds-check.c:9683)
> ==5910== by 0x481CE2: check_chunks_and_extents (cmds-check.c:9886)
> ==5910== by 0x48888B: cmd_check (cmds-check.c:12977)
> ==5910== by 0x40A8C5: main (btrfs.c:246)
> ==5910==
>
> The check_chunks_and_extents() memory leaks are caused by not freeing
> added root items of normal_trees and dropping_trees.
>
> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-05-02 14:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-02 3:17 [PATCH] btrfs-progs: check: Fix memory leak in check_chunks_and_extents Qu Wenruo
2017-05-02 14:28 ` David Sterba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).