At 10/24/2016 10:43 AM, Qu Wenruo wrote:
Ebs and pointers are allocated, but if any of the allocation failed, we should free the allocated memory. Reported-by: David Sterba <dste...@suse.cz> Resolves-Coverity-CID: 1296749
Sorry, wrong CID here, Correct ones are: Resolves-Coverity-CID: 1374101 Resolves-Coverity-CID: 1374100
Signed-off-by: Qu Wenruo <quwen...@cn.fujitsu.com> --- volumes.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/volumes.c b/volumes.c index a7abd92..f687b0d 100644 --- a/volumes.c +++ b/volumes.c @@ -2120,8 +2120,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;
-- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html