diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2009-03-09 10:42:45 +0100 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-03-14 21:06:52 +0100 |
commit | 059ea3318c8ede71851a52b4359fbf1ab0cec301 (patch) | |
tree | 29a70645e27947d820884b1249d0d7f26b8ea0d8 | |
parent | 87092698c665e0a358caf9825ae13114343027e8 (diff) | |
download | linux-059ea3318c8ede71851a52b4359fbf1ab0cec301.tar.bz2 |
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 <lizf@cn.fujitsu.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r-- | fs/bio.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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; |