btrfs: memory leak in btrfs_add_inode_defrag()
authorDan Carpenter <error27@gmail.com>
Fri, 5 Aug 2011 14:19:00 +0000 (14:19 +0000)
committerChris Mason <chris.mason@oracle.com>
Wed, 17 Aug 2011 01:09:15 +0000 (21:09 -0400)
We don't use the defrag struct on this path.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/file.c

index 010aec8be824611b700a340f5ecd86dfb2705101..0705d15542c6717a307fee381784a5c7ee79e6df 100644 (file)
@@ -150,6 +150,8 @@ int btrfs_add_inode_defrag(struct btrfs_trans_handle *trans,
        spin_lock(&root->fs_info->defrag_inodes_lock);
        if (!BTRFS_I(inode)->in_defrag)
                __btrfs_add_inode_defrag(inode, defrag);
+       else
+               kfree(defrag);
        spin_unlock(&root->fs_info->defrag_inodes_lock);
        return 0;
 }