serial: ioc4_serial: Free memory when kzalloc fails during probe
authorSouptick Joarder <jrdr.linux@gmail.com>
Thu, 3 Nov 2016 14:06:54 +0000 (19:36 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Nov 2016 13:50:46 +0000 (14:50 +0100)
commit7f8b4ebeb2a1e7bf7af80926db012c9356f7a662
tree16e1406251fedc28785f49d25c7c573f329d2620
parent65dabaf532ba632d3660fc7943f3fe47c7c56dc0
serial: ioc4_serial: Free memory when kzalloc fails during probe

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@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/ioc4_serial.c