Skip to contentSkip to conversation

Btrfs - Fix memory leak in btrfs_init_new_device()

PATCH New Ilya Dryomov 1 participant 1 message Feb 6, 2011 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Btrfs - Fix memory leak in btrfs_init_new_device()

Memory allocated by calling kstrdup() should be freed.

---
 fs/btrfs/volumes.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
fs/btrfs/volumes.c +1 -0
index d158530..9649cdd 100644
@@ -1601,6 +1601,7 @@ 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;
 	}
Signature · 1 line
1.7.2.3