mirror of
https://github.com/kdave/btrfs-progs
synced 2025-03-05 18:28:24 +00:00
btrfs-progs: Fix memory leak in write_raid56_with_parity
Ebs and pointers are allocated, but if any of the allocation failed, we should free the allocated memory. Resolves-Coverity-CID: 1374101 Resolves-Coverity-CID: 1374100 Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
f529d6472e
commit
388cdce509
@ -2143,8 +2143,11 @@ int write_raid56_with_parity(struct btrfs_fs_info *info,
|
||||
|
||||
ebs = malloc(sizeof(*ebs) * multi->num_stripes);
|
||||
pointers = malloc(sizeof(*pointers) * multi->num_stripes);
|
||||
if (!ebs || !pointers)
|
||||
if (!ebs || !pointers) {
|
||||
free(ebs);
|
||||
free(pointers);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if (stripe_len > alloc_size)
|
||||
alloc_size = stripe_len;
|
||||
|
Loading…
Reference in New Issue
Block a user