summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJoern Engel <joern@logfs.org>2009-11-23 14:29:12 +0100
committerJoern Engel <joern@logfs.org>2009-11-23 14:29:12 +0100
commitddfd1f04b7bc557c1fe9b110e99cebb2e19d4993 (patch)
tree797746cc7cd2334ae16014ed547f7593846a14f5 /fs
parentef6ada3de49074a913fb72f163657158be2c0e98 (diff)
downloadop-kernel-dev-ddfd1f04b7bc557c1fe9b110e99cebb2e19d4993.zip
op-kernel-dev-ddfd1f04b7bc557c1fe9b110e99cebb2e19d4993.tar.gz
[LogFS] Plug memory leak on error paths
Spotted by Dan Carpenter.
Diffstat (limited to 'fs')
-rw-r--r--fs/logfs/dir.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/logfs/dir.c b/fs/logfs/dir.c
index 89104e6..e7659b1 100644
--- a/fs/logfs/dir.c
+++ b/fs/logfs/dir.c
@@ -224,10 +224,14 @@ static int logfs_unlink(struct inode *dir, struct dentry *dentry)
inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
page = logfs_get_dd_page(dir, dentry);
- if (!page)
+ if (!page) {
+ kfree(ta);
return -ENOENT;
- if (IS_ERR(page))
+ }
+ if (IS_ERR(page)) {
+ kfree(ta);
return PTR_ERR(page);
+ }
index = page->index;
page_cache_release(page);
OpenPOWER on IntegriCloud