linux/drivers/mtd/parsers
Manivannan Sadhasivam 7cb52169ad mtd: parsers: afs: Fix freeing the part name memory in failure
[ Upstream commit 7b844cf445f0a7daa68be0ce71eb2c88d68b0c5d ]

In the case of failure while parsing the partitions, the iterator should
be pre decremented by one before starting to free the memory allocated
by kstrdup(). Because in the failure case, kstrdup() will not succeed
and thus no memory will be allocated for the current iteration.

Fixes: 1fca1f6abb ("mtd: afs: simplify partition parsing")
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20210104041137.113075-5-manivannan.sadhasivam@linaro.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-03-04 10:26:24 +01:00
..
Kconfig mtd: parsers: Move CMDLINE parser 2019-09-15 23:50:50 +02:00
Makefile mtd: parsers: Move CMDLINE parser 2019-09-15 23:50:50 +02:00
afs.c mtd: parsers: afs: Fix freeing the part name memory in failure 2021-03-04 10:26:24 +01:00
ar7part.c mtd: parsers: Move TI AR7 parser 2019-09-15 23:50:48 +02:00
bcm47xxpart.c mtd: parsers: Move BCM47xx parser 2019-09-15 23:50:48 +02:00
bcm63xxpart.c mtd: parsers: Move BCM63xx parser 2019-09-15 23:50:49 +02:00
cmdlinepart.c mtd: parser: cmdline: Fix parsing of part-names with colons 2020-12-30 11:51:43 +01:00
ofpart.c mtd: parsers: Move OF parser 2019-09-15 23:50:49 +02:00
parser_imagetag.c mtd: parser: imagetag: fix error codes in bcm963xx_parse_imagetag_partitions() 2021-03-04 10:26:23 +01:00
parser_trx.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
redboot.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 102 2019-05-24 17:39:00 +02:00
sharpslpart.c mtd: sharpslpart: Fix unsigned comparison to zero 2020-02-14 16:34:18 -05:00