Patchwork e2fsprogs: fix possible mem-leak in ext2fs_free_generic_bmap()

login
register
mail settings
Submitter Lukas Czerner
Date Nov. 24, 2010, 11:46 a.m.
Message ID <1290599198-5280-1-git-send-email-lczerner@redhat.com>
Download mbox | patch
Permalink /patch/72839/
State Superseded
Headers show

Comments

Lukas Czerner - Nov. 24, 2010, 11:46 a.m.
ext2fs_free_generic_bmap is supposed to free the ext2fs_generic_bitmap
structure, however it frees just the memory allocated to the members of
the structure but not the memory allocated for the structure itself.
This commit fixes it with simple oneliner by adding free() at the end of
the ext2fs_free_generic_bmap().

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

Patch

diff --git a/lib/ext2fs/gen_bitmap64.c b/lib/ext2fs/gen_bitmap64.c
index 9f23b92..f46f048 100644
--- a/lib/ext2fs/gen_bitmap64.c
+++ b/lib/ext2fs/gen_bitmap64.c
@@ -158,6 +158,7 @@  void ext2fs_free_generic_bmap(ext2fs_generic_bitmap bmap)
 		bmap->description = 0;
 	}
 	bmap->magic = 0;
+	free(bmap);
 }
 
 errcode_t ext2fs_copy_generic_bmap(ext2fs_generic_bitmap src,