]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
libext2fs: Fix memory leak in the extents handling function
authorTheodore Ts'o <tytso@mit.edu>
Mon, 15 Jun 2009 05:34:43 +0000 (01:34 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 15 Jun 2009 05:34:43 +0000 (01:34 -0400)
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

index b7eb617060d4e6b657b2c47739b6752d8450714b..2b88739cedf2508901b22598484c62935af8554b 100644 (file)
@@ -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);
                }