Thread (6 messages) flat view 6 messages, 3 authors, 2021-10-14

Re: [PATCH net 1/2] NFC: digital: fix possible memory leak in digital_tg_listen_mdaa()

From: Krzysztof Kozlowski <hidden>
Date: 2021-10-13 09:35:12
Also in: lkml

On 13/10/2021 09:50, Ziyang Xuan wrote:
'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 <redacted>
---
 net/nfc/digital_core.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
Good catch. Leak is only theoretical as digital_send_cmd() will fail
only on memory allocation failure but your fix makes code correct.


Reviewed-by: Krzysztof Kozlowski <redacted>


Best regards,
Krzysztof
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help