Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 67100f25 authored by Ilya Dryomov's avatar Ilya Dryomov Committed by Chris Mason
Browse files

Btrfs - Fix memory leak in btrfs_init_new_device()



Memory allocated by calling kstrdup() should be freed.

Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent 51788b1b
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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;