[Ocfs2-tools-devel] [PATCH 2/2] ocfs2-tools: fix a few memory leak problems about ocfs2_bitmap_free
piaojun
piaojun at huawei.com
Tue Mar 1 00:50:23 PST 2016
Fix a few memory leak problems about ocfs2_bitmap_free.
Signed-off-by: Jun Piao <piaojun at huawei.com>
---
extras/find_dup_extents.c | 1 +
extras/find_hardlinks.c | 7 ++++++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/extras/find_dup_extents.c b/extras/find_dup_extents.c
index f33d8ed..f398515 100644
--- a/extras/find_dup_extents.c
+++ b/extras/find_dup_extents.c
@@ -261,6 +261,7 @@ int main(int argc, char *argv[])
ret = ocfs2_cluster_bitmap_new(fs, "Dup extent map",
&we.dup_map);
if (ret) {
+ ocfs2_bitmap_free(&we.extent_map);
com_err(argv[0], ret,
"while creating the dup map");
goto out_close;
diff --git a/extras/find_hardlinks.c b/extras/find_hardlinks.c
index 2e1f697..710a403 100644
--- a/extras/find_hardlinks.c
+++ b/extras/find_hardlinks.c
@@ -158,7 +158,7 @@ int main(int argc, char *argv[])
uint64_t blkno;
char *filename;
ocfs2_filesys *fs;
- struct walk_path wp;
+ struct walk_path wp = {0};
blkno = OCFS2_SUPER_BLOCK_BLKNO;
@@ -264,6 +264,11 @@ int main(int argc, char *argv[])
}
out_close:
+ if (wp.inode_map)
+ ocfs2_bitmap_free(&wp.inode_map);
+ if (wp.dup_map)
+ ocfs2_bitmap_free(&wp.dup_map);
+
ret = ocfs2_close(fs);
if (ret) {
com_err(argv[0], ret,
--
1.8.4.3
More information about the Ocfs2-tools-devel
mailing list