aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShen Feng <shen@cn.fujitsu.com>2009-01-05 15:43:42 -0500
committerChris Mason <chris.mason@oracle.com>2009-01-05 15:43:42 -0500
commit1f48366084a7b046bcb7741ed4e607774f96e3da (patch)
treee85d1e0dccccc78689a833373933c001c5d05adb
parentc584482b47f47b051cdc1d5236b99ad18f1b1cfb (diff)
Btrfs: fix a memory leak in btrfs_get_sb
subvol_name should be freed if error occurs. Signed-off-by: Shen Feng <shen@cn.fujitsu.com>
-rw-r--r--fs/btrfs/super.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 3814238d6eb..ccdcb7bb7ad 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -429,7 +429,7 @@ static int btrfs_get_sb(struct file_system_type *fs_type, int flags,
error = btrfs_parse_early_options(data, mode, fs_type,
&subvol_name, &fs_devices);
if (error)
- goto error;
+ return error;
error = btrfs_scan_one_device(dev_name, mode, fs_type, &fs_devices);
if (error)
@@ -468,7 +468,7 @@ static int btrfs_get_sb(struct file_system_type *fs_type, int flags,
if (error) {
up_write(&s->s_umount);
deactivate_super(s);
- goto error;
+ goto error_free_subvol_name;
}
btrfs_sb(s)->fs_info->bdev_holder = fs_type;
@@ -485,14 +485,14 @@ static int btrfs_get_sb(struct file_system_type *fs_type, int flags,
up_write(&s->s_umount);
deactivate_super(s);
error = PTR_ERR(root);
- goto error;
+ goto error_free_subvol_name;
}
if (!root->d_inode) {
dput(root);
up_write(&s->s_umount);
deactivate_super(s);
error = -ENXIO;
- goto error;
+ goto error_free_subvol_name;
}
}
@@ -508,7 +508,6 @@ error_close_devices:
btrfs_close_devices(fs_devices);
error_free_subvol_name:
kfree(subvol_name);
-error:
return error;
}