[PATCH] e2fsprogs: fix memory leak in ext2fs_free_generic_bmap()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In ext2fs_free_generic_bmap() when we are freeing 64-bit bitmap, we do
call free_bmap() to free backend specific bitmap structures, however we
should also free ext2fs_generic_bitmap structure as well. So this commit
fixes that and removes unnecessary assignments.

Signed-off-by: Lukas Czerner <lczerner@xxxxxxxxxx>
---
 lib/ext2fs/gen_bitmap64.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/ext2fs/gen_bitmap64.c b/lib/ext2fs/gen_bitmap64.c
index 8b9e4c5..f343cc7 100644
--- a/lib/ext2fs/gen_bitmap64.c
+++ b/lib/ext2fs/gen_bitmap64.c
@@ -153,11 +153,11 @@ void ext2fs_free_generic_bmap(ext2fs_generic_bitmap bmap)
 
 	bmap->bitmap_ops->free_bmap(bmap);
 
-	if (bmap->description) {
+	if (bmap->description)
 		ext2fs_free_mem(&bmap->description);
-		bmap->description = 0;
-	}
-	bmap->magic = 0;
+
+	ext2fs_free_mem(&bmap);
+	bmap = NULL;
 }
 
 errcode_t ext2fs_copy_generic_bmap(ext2fs_generic_bitmap src,
-- 
1.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux