If bio_integrity_clone() fails, bio_clone() returns NULL without freeing the newly allocated bio.
Unified · Split
| @@ -465,8 +465,10 @@ struct bio *bio_clone(struct bio *bio, gfp_t gfp_mask) · 464 unmodified lines | ||
| 465 | 465 | |
| 466 | 466 | ret = bio_integrity_clone(b, bio, gfp_mask, fs_bio_set); |
| 467 | 467 | |
| 468 | − if (ret < 0) | |
| 468 | + if (ret < 0) { | |
| 469 | + bio_put(b); | |
| 469 | 470 | return NULL; |
| 471 | + } | |
| 470 | 472 | } |
| 471 | 473 | |
| 472 | 474 | return b; |