[PATCH v4 4/4] mtd: parsers: afs: Fix freeing the part name memory in failure

Miquel Raynal miquel.raynal at bootlin.com
Mon Jan 4 05:26:06 EST 2021


On Mon, 2021-01-04 at 04:11:37 UTC, Manivannan Sadhasivam wrote:
> 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: 1fca1f6abb38 ("mtd: afs: simplify partition parsing")
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam at linaro.org>
> Reviewed-by: Linus Walleij <linus.walleij at linaro.org>
> Cc: Linus Walleij <linus.walleij at linaro.org>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel



More information about the linux-mtd mailing list