NFC: digital: fix possible memory leak in digital_tg_listen_mdaa()
authorZiyang Xuan <william.xuanziyang@huawei.com>
Wed, 13 Oct 2021 07:50:12 +0000 (15:50 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Oct 2021 07:33:58 +0000 (09:33 +0200)
commita67d47e32c91e2b10402cb8c081774cbf08edb2e
tree770c14d435107db750bb2a26212dcb568ee2d174
parent9285dbe89682b0892cd5e45d7728484779b3a8d2
NFC: digital: fix possible memory leak in digital_tg_listen_mdaa()

commit 58e7dcc9ca29c14e44267a4d0ea61e3229124907 upstream.

'params' is allocated in digital_tg_listen_mdaa(), but not free when
digital_send_cmd() failed, which will cause memory leak. Fix it by
freeing 'params' if digital_send_cmd() return failed.

Fixes: 1c7a4c24fbfd ("NFC Digital: Add target NFC-DEP support")
Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/nfc/digital_core.c