NFC: llcp: Fix 2 memory leaks

Once copied into the sk_buff data area using llcp_add_tlv(), the
allocated TLVs must be freed.

With this patch nfc_llcp_send_connect() and nfc_llcp_send_cc() don't
return immediately on success and now free the allocated TLVs.

Signed-off-by: Thierry Escande <thierry.escande@collabora.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
Thierry Escande 2016-06-29 10:48:23 +02:00 committed by Samuel Ortiz
parent de9e5aeb4f
commit 256f3ee3d1
1 changed files with 6 additions and 4 deletions

View File

@ -444,10 +444,11 @@ int nfc_llcp_send_connect(struct nfc_llcp_sock *sock)
skb_queue_tail(&local->tx_queue, skb);
return 0;
err = 0;
error_tlv:
pr_err("error %d\n", err);
if (err)
pr_err("error %d\n", err);
kfree(service_name_tlv);
kfree(miux_tlv);
@ -495,10 +496,11 @@ int nfc_llcp_send_cc(struct nfc_llcp_sock *sock)
skb_queue_tail(&local->tx_queue, skb);
return 0;
err = 0;
error_tlv:
pr_err("error %d\n", err);
if (err)
pr_err("error %d\n", err);
kfree(miux_tlv);
kfree(rw_tlv);