* [PATCH] libext2fs: Fix memory leak in the extents handling function
@ 2009-06-15 7:49 Theodore Ts'o
0 siblings, 0 replies; only message in thread
From: Theodore Ts'o @ 2009-06-15 7:49 UTC (permalink / raw)
To: Ext4 Developers List; +Cc: Theodore Ts'o
Each time an extent handle is opened and closed, if the inode has an
extent tree which does not fit in the inode's i_block structure, a
filesystem block buffer was not getting released. Since e2fsck opens
an extent handle for every inode using extents, this can translate to
a very large amount of memory getting lost.
Thanks to Henrik 'Mauritz' Johnson for discovering and pointing out
this leak, which he ran into while running the "rdump" command in
debugfs.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
lib/ext2fs/extent.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/ext2fs/extent.c b/lib/ext2fs/extent.c
index b7eb617..2b88739 100644
--- a/lib/ext2fs/extent.c
+++ b/lib/ext2fs/extent.c
@@ -168,7 +168,7 @@ extern void ext2fs_extent_free(ext2_extent_handle_t handle)
if (handle->inode)
ext2fs_free_mem(&handle->inode);
if (handle->path) {
- for (i=1; i < handle->max_depth; i++) {
+ for (i=1; i <= handle->max_depth; i++) {
if (handle->path[i].buf)
ext2fs_free_mem(&handle->path[i].buf);
}
--
1.6.3.2.1.gb9f7d.dirty
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2009-06-15 7:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-15 7:49 [PATCH] libext2fs: Fix memory leak in the extents handling function Theodore Ts'o
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).