From: Andi Shyti <andi@etezian.org>
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 [thread overview]
Message-ID: <1374710980-5707-1-git-send-email-andi@etezian.org> (raw)
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 <andi@etezian.org>
---
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
next reply other threads:[~2013-07-25 0:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-25 0:09 Andi Shyti [this message]
2013-07-25 8:18 ` [PATCH] btrfs: raid56: avoid double allocation Liu Bo
2013-07-25 8:26 ` Miao Xie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1374710980-5707-1-git-send-email-andi@etezian.org \
--to=andi@etezian.org \
--cc=chris.mason@fusionio.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).