Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -465,9 +465,11 @@ struct bio *bio_clone(struct bio *bio, gfp_t gfp_mask)


		ret = bio_integrity_clone(b, bio, gfp_mask, fs_bio_set);
		ret = bio_integrity_clone(b, bio, gfp_mask, fs_bio_set);


		if (ret < 0)
		if (ret < 0) {
			bio_put(b);
			return NULL;
			return NULL;
		}
		}
	}


	return b;
	return b;
}
}