From: Lukas Czerner <lczerner@redhat.com>
To: linux-ext4@vger.kernel.org
Cc: tytso@mit.edu, Lukas Czerner <lczerner@redhat.com>
Subject: [PATCH] e2fsprogs: fix memory leak in ext2fs_free_generic_bmap()
Date: Mon, 21 Mar 2011 11:14:00 +0100 [thread overview]
Message-ID: <1300702440-4835-1-git-send-email-lczerner@redhat.com> (raw)
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@redhat.com>
---
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
next reply other threads:[~2011-03-21 10:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-21 10:14 Lukas Czerner [this message]
2011-05-08 22:10 ` [PATCH] e2fsprogs: fix memory leak in ext2fs_free_generic_bmap() Ted Ts'o
2011-05-09 8:09 ` Lukas Czerner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1300702440-4835-1-git-send-email-lczerner@redhat.com \
--to=lczerner@redhat.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).