Whamcloud - gitweb
[COVERITY] Fix (error case only) memory leak in e2fsck pass #1
authorBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 28 Mar 2007 15:57:20 +0000 (11:57 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 28 Mar 2007 15:57:20 +0000 (11:57 -0400)
Coverity ID: 37: Resource Leak
Coverity ID: 38: Resource Leak

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
e2fsck/ChangeLog
e2fsck/pass1.c

index e3a1dff..20cea4d 100644 (file)
@@ -1,7 +1,7 @@
 2007-03-28  Theodore Tso  <tytso@mit.edu>
 
-       * pass1.c (check_ext_attr), unix.c (parse_extended_opts): Fix
-               memory leak
+       * pass1.c (e2fsck_pass1, check_ext_attr), 
+               unix.c (parse_extended_opts): Fix memory leak
 
 2007-03-21  Theodore Tso  <tytso@mit.edu>
 
index 6dcddc9..095f244 100644 (file)
@@ -481,6 +481,7 @@ void e2fsck_pass1(e2fsck_t ctx)
        if (pctx.errcode) {
                fix_problem(ctx, PR_1_ALLOCATE_DBCOUNT, &pctx);
                ctx->flags |= E2F_FLAG_ABORT;
+               ext2fs_free_mem(&inode);
                return;
        }
 
@@ -508,6 +509,8 @@ void e2fsck_pass1(e2fsck_t ctx)
        if (pctx.errcode) {
                fix_problem(ctx, PR_1_ISCAN_ERROR, &pctx);
                ctx->flags |= E2F_FLAG_ABORT;
+               ext2fs_free_mem(&block_buf);
+               ext2fs_free_mem(&inode);
                return;
        }
        ext2fs_inode_scan_flags(scan, EXT2_SF_SKIP_MISSING_ITABLE, 0);