serial: vt8500: fix possible memory leak in vt8500_serial_probe()
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>
Mon, 8 Oct 2012 02:35:46 +0000 (10:35 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Oct 2012 18:34:51 +0000 (11:34 -0700)
commit59c2e855e43735f4ab93b8b8db96206219f6c1d4
tree86eb4bdf02a007a9d79ae70122a69462f002a22e
parent54ec52b6dd3b0ba4bc4eb97e7e1b2534705b326c
serial: vt8500: fix possible memory leak in vt8500_serial_probe()

vt8500_port is malloced in vt8500_serial_probe() and should be freed
before leaving from the error handling cases, otherwise it will
cause memory leak.
Fix it by move the allocation of vt8500_port after those test.

dpatch engine is used to auto generate this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Acked-by: Tony Prisk <linux@prisktech.co.nz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/vt8500_serial.c