summaryrefslogtreecommitdiff
path: root/fs/logfs
diff options
context:
space:
mode:
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>2012-09-02 22:19:06 +0800
committerPrasad Joshi <prasadjoshi.linux@gmail.com>2012-09-03 09:20:47 +0530
commitab2ec19f42dc084880ba9b77e1c153adc1e9c439 (patch)
treec7b2c6a70de3383b421758518b86ed098b8d4eea /fs/logfs
parent5b716ac728bcc01b1f2a7ed6e437196602237c27 (diff)
logfs: fix possible memory leak in logfs_mtd_can_write_buf()
buf has been allocated in this function and should be freed before leaving from the error handling case. spatch with a semantic match is used to found this problem. (http://coccinelle.lip6.fr/) Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Prasad Joshi <prasadjoshi.linux@gmail.com>
Diffstat (limited to 'fs/logfs')
-rw-r--r--fs/logfs/dev_mtd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/logfs/dev_mtd.c b/fs/logfs/dev_mtd.c
index 9c501449450d..427bb73e298f 100644
--- a/fs/logfs/dev_mtd.c
+++ b/fs/logfs/dev_mtd.c
@@ -245,8 +245,8 @@ static int logfs_mtd_can_write_buf(struct super_block *sb, u64 ofs)
goto out;
if (memchr_inv(buf, 0xff, super->s_writesize))
err = -EIO;
- kfree(buf);
out:
+ kfree(buf);
return err;
}