Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=cfa72397cf3a15f2841447440fd53980b3ecd624
Commit:     cfa72397cf3a15f2841447440fd53980b3ecd624
Parent:     0d36da3b409536a24266c5f0972f2e1cfae1afd4
Author:     Dmitry Adamushko <[EMAIL PROTECTED]>
AuthorDate: Fri Jan 19 01:20:30 2007 +0100
Committer:  David Woodhouse <[EMAIL PROTECTED]>
CommitDate: Fri Feb 9 15:00:21 2007 +0000

    JFFS2: memory leak in jffs2_do_mount_fs()
    
    If  jffs2_sum_init()  fails,  c->blocks is not freed neither in
    jffs2_do_mount_fs() nor in jffs2_do_fill_super().
    
    Signed-off-by: Dmitry Adamushko <[EMAIL PROTECTED]>
    Signed-off-by: David Woodhouse <[EMAIL PROTECTED]>
---
 fs/jffs2/build.c |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/fs/jffs2/build.c b/fs/jffs2/build.c
index 0282696..07119c4 100644
--- a/fs/jffs2/build.c
+++ b/fs/jffs2/build.c
@@ -348,23 +348,27 @@ int jffs2_do_mount_fs(struct jffs2_sb_info *c)
 
        ret = jffs2_sum_init(c);
        if (ret)
-               return ret;
+               goto out_free;
 
        if (jffs2_build_filesystem(c)) {
                dbg_fsbuild("build_fs failed\n");
                jffs2_free_ino_caches(c);
                jffs2_free_raw_node_refs(c);
-#ifndef __ECOS
-               if (jffs2_blocks_use_vmalloc(c))
-                       vfree(c->blocks);
-               else
-#endif
-                       kfree(c->blocks);
-
-               return -EIO;
+               ret = -EIO;
+               goto out_free;
        }
 
        jffs2_calc_trigger_levels(c);
 
        return 0;
+
+ out_free:
+#ifndef __ECOS
+       if (jffs2_blocks_use_vmalloc(c))
+               vfree(c->blocks);
+       else
+#endif
+               kfree(c->blocks);
+
+       return ret;
 }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to