Re: [PATCH] mfd: Fix memory leak in mfd_add_devices()

From: Lee Jones
Date: Wed Dec 04 2013 - 03:30:45 EST


On Tue, 29 Oct 2013, Geert Uytterhoeven wrote:

> If the first call to mfd_add_device() fails, no child devices have been
> registered to the parent yet, and thus mfd_remove_devices() won't find
> anything to remove nor free.
> Hence the previously allocated array of atomic_t objects will leak.
>
> Free the array instead of calling mfd_remove_devices() on failure during
> the first loop iteration to fix this.
>
> Signed-off-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
> ---
> drivers/mfd/mfd-core.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)

Hmm... I didn't see my reply to this, but it has been applied for a
while.

--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org â Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/