Commit 059ea331 authored by Li Zefan's avatar Li Zefan Committed by Jens Axboe
Browse files

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: default avatarLi Zefan <lizf@cn.fujitsu.com>
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent 87092698
......@@ -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;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment