Re: [PATCH v2] serial: Free memory when kzalloc fails during probe

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

 



On Thu, Nov 03, 2016 at 07:36:54PM +0530, Souptick Joarder wrote:
> Inside ioc4_attach_local() 4 memory was allocated using kzalloc and
> assign it to ports[] within loop. When kzalloc fails inside loop,
> it returns error without freeing previously allocated memory and we
> may have memory leak. Fix this by freeing ports[] before return.
> 
> Signed-off-by: Souptick joarder <jrdr.linux@xxxxxxxxx>
> ---
> v2:
>   - Address comment from Sahu
>    * Put new line before free
>    * replace for loop with while
> 
>  drivers/tty/serial/ioc4_serial.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)

In the future, put the driver name in the subject: line, to make it
easier to see what serial driver you are changing.  I'll fix it up this
time...

thanks,

greg k-h
--
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