Skip to content

Commit

Permalink
block: fix memory leak in bio_clone()
Browse files Browse the repository at this point in the history
If bio_integrity_clone() fails, bio_clone() returns NULL without freeing
the newly allocated bio.

Signed-off-by: Li Zefan <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Li Zefan authored and Jens Axboe committed Mar 14, 2009
1 parent 8709269 commit 059ea33
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/bio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 059ea33

Please sign in to comment.