Re: [PATCH] serial: Free memory when probe fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 28, 2016 at 5:30 PM, Souptick Joarder <jrdr.linux@xxxxxxxxx> wrote:
> When spi_setup() fails it doesn't free ifx_dev and we have a memory
> leak. Fix this by freeing ifx_dev before the return.
>
> Signed-off-by: Souptick joarder <jrdr.linux@xxxxxxxxx>
> ---
>  drivers/tty/serial/ifx6x60.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
> index d386346..1578836 100644
> --- a/drivers/tty/serial/ifx6x60.c
> +++ b/drivers/tty/serial/ifx6x60.c
> @@ -1042,6 +1042,7 @@ static int ifx_spi_spi_probe(struct spi_device *spi)
>         ret = spi_setup(spi);
>         if (ret) {
>                 dev_err(&spi->dev, "SPI setup wasn't successful %d", ret);
> +               kfree(ifx_dev);
>                 return -ENODEV;
>         }
>
> --
> 1.9.1
>

Any comment on this patch?
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux