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

Commit 5fdd2cf8 authored by majianpeng's avatar majianpeng Committed by NeilBrown
Browse files

md/raid10: Fix memleak in r10buf_pool_alloc



If the allocation of rep1_bio fails, we currently don't free the 'bio'
of the same dev.

Reported by kmemleak.

Signed-off-by: default avatarmajianpeng <majianpeng@gmail.com>
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent da8840a7
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -173,9 +173,10 @@ out_free_pages:
	while (j--)
		for (i = 0; i < RESYNC_PAGES ; i++)
			safe_put_page(r10_bio->devs[j].bio->bi_io_vec[i].bv_page);
	j = -1;
	j = 0;
out_free_bio:
	while (++j < nalloc) {
	for ( ; j < nalloc; j++) {
		if (r10_bio->devs[j].bio)
			bio_put(r10_bio->devs[j].bio);
		if (r10_bio->devs[j].repl_bio)
			bio_put(r10_bio->devs[j].repl_bio);