From: Ilya Dryomov Date: Sun, 6 Feb 2011 19:58:21 +0000 (+0000) Subject: Btrfs - Fix memory leak in btrfs_init_new_device() X-Git-Tag: upstream/snapshot3+hdmi~11282^2~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=67100f255dba284bcbb5ce795355dad1cff35658;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git Btrfs - Fix memory leak in btrfs_init_new_device() Memory allocated by calling kstrdup() should be freed. Signed-off-by: Ilya Dryomov Signed-off-by: Chris Mason --- diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 7cad593..dadaaa8 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -1603,12 +1603,14 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path) ret = find_next_devid(root, &device->devid); if (ret) { + kfree(device->name); kfree(device); goto error; } trans = btrfs_start_transaction(root, 0); if (IS_ERR(trans)) { + kfree(device->name); kfree(device); ret = PTR_ERR(trans); goto error;