]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
[COVERITY] Fix (error case) memory leak in debugfs
authorBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 21 Mar 2007 21:53:33 +0000 (17:53 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 21 Mar 2007 21:53:33 +0000 (17:53 -0400)
Handle leaked cbuf due to early returns with a generic failure path.

Coverity ID: 24: Resource Leak

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
debugfs/ChangeLog
debugfs/htree.c

index ae7d09b1435b76771f05599a299c15ae4dc6439f..3a189af3bfb7ec3f94b5839fe4d3cd431d8cb089 100644 (file)
@@ -1,5 +1,7 @@
 2007-03-21  Theodore Tso  <tytso@mit.edu>
 
+       * htree.c (htree_dump_int_block): Fix memory leak on error paths.
+
        * dump.c (rdump_dirent), htree.c (htree_dump_leaf_node), 
                ls.c (list_dir_proc): Add an extra byte to EXT2_NAME_LEN
                to avoid the possibility of an array overrun if the
index 2d51ec3ab11fffdb6a0206e8422946d4b8bc6934..bd1fd5128749b9a2645473ab2fc4bfe23034c49f 100644 (file)
@@ -161,19 +161,20 @@ static void htree_dump_int_block(ext2_filsys fs, ext2_ino_t ino,
        if (errcode) {
                com_err("htree_dump_int_block", errcode,
                        "while mapping logical block %u\n", blk);
-               return;
+               goto errout;
        }
 
        errcode = io_channel_read_blk(current_fs->io, pblk, 1, buf);
        if (errcode) {
                com_err("htree_dump_int_block", errcode,
                        "while  reading block %u\n", blk);
-               return;
+               goto errout;
        }
 
        htree_dump_int_node(fs, ino, inode, rootnode,
                            (struct ext2_dx_entry *) (buf+8),
                            cbuf, level);
+errout:
        free(cbuf);
 }