net: kalmia: fix memory leaks
authorWenwen Wang <wenwen@cs.uga.edu>
Wed, 14 Aug 2019 18:56:43 +0000 (13:56 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 10 Sep 2019 09:33:48 +0000 (10:33 +0100)
commit4fcb9b3f263efde74d97190e43c690b4ed732bbf
tree6729bc51e78fb6496aac0288aa9ce2c5753fd9b3
parent1ad45d0f69d250fbd2eac38c94b6069eea0dcb6d
net: kalmia: fix memory leaks

[ Upstream commit f1472cb09f11ddb41d4be84f0650835cb65a9073 ]

In kalmia_init_and_get_ethernet_addr(), 'usb_buf' is allocated through
kmalloc(). In the following execution, if the 'status' returned by
kalmia_send_init_packet() is not 0, 'usb_buf' is not deallocated, leading
to memory leaks. To fix this issue, add the 'out' label to free 'usb_buf'.

Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/usb/kalmia.c