mtd: parsers: qcom: Fix leaking of partition name
authorAnsuel Smith <ansuelsmth@gmail.com>
Tue, 25 May 2021 23:09:31 +0000 (01:09 +0200)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Wed, 26 May 2021 09:01:37 +0000 (11:01 +0200)
commit10f3b4d79958d6f9f71588c6fa862159c83fa80f
tree48cb00385792a740df0c7643998d46e0c355387b
parenteb1765c40530ccc8690b9dad88cec6aaa6bfb498
mtd: parsers: qcom: Fix leaking of partition name

Add cleanup function as the name variable for the partition name was
allocaed but never freed after the use as the add mtd function
duplicate the name and free the pparts struct as the partition name is
assumed to be static.
The leak was found using kmemleak.

Fixes: 803eb124e1a6 ("mtd: parsers: Add Qcom SMEM parser")
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20210525230931.30013-1-ansuelsmth@gmail.com
drivers/mtd/parsers/qcomsmempart.c