提交 256f3ee3 编写于 作者: T Thierry Escande 提交者: Samuel Ortiz

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: NThierry Escande <thierry.escande@collabora.com>
Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
上级 de9e5aeb
...@@ -444,10 +444,11 @@ int nfc_llcp_send_connect(struct nfc_llcp_sock *sock) ...@@ -444,10 +444,11 @@ int nfc_llcp_send_connect(struct nfc_llcp_sock *sock)
skb_queue_tail(&local->tx_queue, skb); skb_queue_tail(&local->tx_queue, skb);
return 0; err = 0;
error_tlv: error_tlv:
pr_err("error %d\n", err); if (err)
pr_err("error %d\n", err);
kfree(service_name_tlv); kfree(service_name_tlv);
kfree(miux_tlv); kfree(miux_tlv);
...@@ -495,10 +496,11 @@ int nfc_llcp_send_cc(struct nfc_llcp_sock *sock) ...@@ -495,10 +496,11 @@ int nfc_llcp_send_cc(struct nfc_llcp_sock *sock)
skb_queue_tail(&local->tx_queue, skb); skb_queue_tail(&local->tx_queue, skb);
return 0; err = 0;
error_tlv: error_tlv:
pr_err("error %d\n", err); if (err)
pr_err("error %d\n", err);
kfree(miux_tlv); kfree(miux_tlv);
kfree(rw_tlv); kfree(rw_tlv);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册