summaryrefslogtreecommitdiffstats
path: root/net/nfc/llcp_commands.c
diff options
context:
space:
mode:
authorThierry Escande <thierry.escande@collabora.com>2016-06-29 10:48:23 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2016-07-06 10:02:06 +0200
commit256f3ee3d1468660ca3b10ad3beab7e8f6cbd969 (patch)
tree2691c87eaa34f7a20f82103f68e7e515ba03a552 /net/nfc/llcp_commands.c
parentNFC: llcp: Fix usage of llcp_add_tlv() (diff)
downloadlinux-256f3ee3d1468660ca3b10ad3beab7e8f6cbd969.tar.xz
linux-256f3ee3d1468660ca3b10ad3beab7e8f6cbd969.zip
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>
Diffstat (limited to 'net/nfc/llcp_commands.c')
-rw-r--r--net/nfc/llcp_commands.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/net/nfc/llcp_commands.c b/net/nfc/llcp_commands.c
index 4112d009b032..c5959ce503e6 100644
--- a/net/nfc/llcp_commands.c
+++ b/net/nfc/llcp_commands.c
@@ -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);