Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754341Ab3GYAJ4 (ORCPT ); Wed, 24 Jul 2013 20:09:56 -0400 Received: from etezian.org ([198.101.225.253]:40087 "EHLO mail.etezian.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752685Ab3GYAJz (ORCPT ); Wed, 24 Jul 2013 20:09:55 -0400 From: Andi Shyti To: chris.mason@fusionio.com Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, andi@etezian.org Subject: [PATCH] btrfs: raid56: avoid double allocation Date: Thu, 25 Jul 2013 02:09:40 +0200 Message-Id: <1374710980-5707-1-git-send-email-andi@etezian.org> X-Mailer: git-send-email 1.8.3.2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 976 Lines: 34 alloc_rbio frees already bbio and raid_map, therefore they don't need to be freed in case it fails Signed-off-by: Andi Shyti --- fs/btrfs/raid56.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c index 0525e13..35fe775 100644 --- a/fs/btrfs/raid56.c +++ b/fs/btrfs/raid56.c @@ -1687,11 +1687,9 @@ int raid56_parity_write(struct btrfs_root *root, struct bio *bio, struct blk_plug_cb *cb; rbio = alloc_rbio(root, bbio, raid_map, stripe_len); - if (IS_ERR(rbio)) { - kfree(raid_map); - kfree(bbio); + if (IS_ERR(rbio)) return PTR_ERR(rbio); - } + bio_list_add(&rbio->bio_list, bio); rbio->bio_list_bytes = bio->bi_size; -- 1.8.3.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/