OSDN Git Service

mtd: parsers: qcom: Fix missing free for pparts in cleanup
authorAnsuel Smith <ansuelsmth@gmail.com>
Sun, 16 Jan 2022 03:22:11 +0000 (04:22 +0100)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Tue, 25 Jan 2022 09:32:07 +0000 (10:32 +0100)
Mtdpart doesn't free pparts when a cleanup function is declared.
Add missing free for pparts in cleanup function for smem to fix the
leak.

Fixes: 10f3b4d79958 ("mtd: parsers: qcom: Fix leaking of partition name")
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20220116032211.9728-2-ansuelsmth@gmail.com
drivers/mtd/parsers/qcomsmempart.c

index 469d466..4311b89 100644 (file)
@@ -174,6 +174,8 @@ static void parse_qcomsmem_cleanup(const struct mtd_partition *pparts,
 
        for (i = 0; i < nr_parts; i++)
                kfree(pparts[i].name);
+
+       kfree(pparts);
 }
 
 static const struct of_device_id qcomsmem_of_match_table[] = {