mirror of
https://github.com/kdave/btrfs-progs
synced 2025-02-16 09:46:55 +00:00
libbtrfsutil: fix memory leak in deleted_subvolumes()
If we fail to reallocate the ID array, we still need to free it. Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
c41c5b1562
commit
f5dd778f52
@ -1353,8 +1353,10 @@ PUBLIC enum btrfs_util_error btrfs_util_deleted_subvolumes_fd(int fd,
|
||||
new_capacity = capacity ? capacity * 2 : 1;
|
||||
new_ids = reallocarray(*ids, new_capacity,
|
||||
sizeof(**ids));
|
||||
if (!new_ids)
|
||||
return BTRFS_UTIL_ERROR_NO_MEMORY;
|
||||
if (!new_ids) {
|
||||
err = BTRFS_UTIL_ERROR_NO_MEMORY;
|
||||
goto out;
|
||||
}
|
||||
|
||||
*ids = new_ids;
|
||||
capacity = new_capacity;
|
||||
|
Loading…
Reference in New Issue
Block a user