HID: elan: Fix memleak in elan_input_configured
authorDinghao Liu <dinghao.liu@zju.edu.cn>
Mon, 31 Aug 2020 09:06:43 +0000 (17:06 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Sep 2020 11:55:36 +0000 (13:55 +0200)
commiteb525e6a54990db54a39f0591505f80b67cc3c65
tree2f71390e03b5694e2bd380c80564f3785a6ed649
parentdac76fe22da5bd38e03b0c25e5ba388ae1c5a545
HID: elan: Fix memleak in elan_input_configured

[ Upstream commit b7429ea53d6c0936a0f10a5d64164f0aea440143 ]

When input_mt_init_slots() fails, input should be freed
to prevent memleak. When input_register_device() fails,
we should call input_mt_destroy_slots() to free memory
allocated by input_mt_init_slots().

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hid/hid-elan.c