ext4: fix possible memory leak in ext4_remount()
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>
Sat, 2 Mar 2013 22:13:55 +0000 (17:13 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 2 Mar 2013 22:13:55 +0000 (17:13 -0500)
'orig_data' is malloced in ext4_remount() and should be freed
before leaving from the error handling cases, otherwise it will
cause memory leak.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Cc: stable@vger.kernel.org
fs/ext4/super.c

index 1ae5860b30a31fd5bc2ccad61e611ccf9e2d5fa2..6ac9c8a3eb08b827fc904ebc3960f50260e9bcac 100644 (file)
@@ -4543,6 +4543,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
                        if (!old_opts.s_qf_names[i]) {
                                for (j = 0; j < i; j++)
                                        kfree(old_opts.s_qf_names[j]);
+                               kfree(orig_data);
                                return -ENOMEM;
                        }
                } else