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

From: Miquel Raynal
Date: Mon Jan 04 2021 - 05:26:59 EST


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@xxxxxxxxxx>
> Reviewed-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
> Cc: Linus Walleij <linus.walleij@xxxxxxxxxx>

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

Miquel