[PATCH] ubi: fastmap: fix ubi->fm memory leak

Markus Elfring Markus.Elfring at web.de
Thu Nov 6 07:16:05 PST 2025


…
> +++ b/drivers/mtd/ubi/fastmap.c
> @@ -1644,3 +1644,15 @@ int ubi_update_fastmap(struct ubi_device *ubi)
…
> +void ubi_free_fastmap(struct ubi_device *ubi)
> +{
> +	int i;
> +
> +	if (ubi->fm) {
> +		for (i = 0; i < ubi->fm->used_blocks; i++)
> +			kmem_cache_free(ubi_wl_entry_slab, ubi->fm->e[i]);
…
> +	}
> +}
…

May the local variable “i” be defined in the loop header?

Regards,
Markus



More information about the linux-mtd mailing list