[LogFS] Plug memory leak on error paths
authorJoern Engel <joern@logfs.org>
Mon, 23 Nov 2009 13:29:12 +0000 (14:29 +0100)
committerJoern Engel <joern@logfs.org>
Mon, 23 Nov 2009 13:29:12 +0000 (14:29 +0100)
Spotted by Dan Carpenter.

fs/logfs/dir.c

index 89104e6..e7659b1 100644 (file)
@@ -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);