Skip to content

Commit

Permalink
Btrfs - Fix memory leak in btrfs_init_new_device()
Browse files Browse the repository at this point in the history
Memory allocated by calling kstrdup() should be freed.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
  • Loading branch information
Ilya Dryomov authored and Chris Mason committed Feb 14, 2011
1 parent 51788b1 commit 67100f2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/btrfs/volumes.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 67100f2

Please sign in to comment.