From: Li Zefan Date: Mon, 9 Mar 2009 09:42:45 +0000 (+0100) Subject: block: fix memory leak in bio_clone() X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=059ea3318c8ede71851a52b4359fbf1ab0cec301;p=linux-2.6-omap-h63xx.git block: fix memory leak in bio_clone() If bio_integrity_clone() fails, bio_clone() returns NULL without freeing the newly allocated bio. Signed-off-by: Li Zefan Signed-off-by: Jens Axboe --- diff --git a/fs/bio.c b/fs/bio.c index cf747378b97..d4f06327c81 100644 --- a/fs/bio.c +++ b/fs/bio.c @@ -465,8 +465,10 @@ struct bio *bio_clone(struct bio *bio, gfp_t gfp_mask) ret = bio_integrity_clone(b, bio, gfp_mask, fs_bio_set); - if (ret < 0) + if (ret < 0) { + bio_put(b); return NULL; + } } return b;