diff options
author | Thierry Escande <thierry.escande@collabora.com> | 2016-06-29 04:48:23 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2016-07-06 04:02:06 -0400 |
commit | 256f3ee3d1468660ca3b10ad3beab7e8f6cbd969 (patch) | |
tree | 2691c87eaa34f7a20f82103f68e7e515ba03a552 /net/nfc | |
parent | de9e5aeb4f40e72fa3bb087d378c9bd4ecf65c7f (diff) |
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')
-rw-r--r-- | net/nfc/llcp_commands.c | 10 |
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) | |||
444 | 444 | ||
445 | skb_queue_tail(&local->tx_queue, skb); | 445 | skb_queue_tail(&local->tx_queue, skb); |
446 | 446 | ||
447 | return 0; | 447 | err = 0; |
448 | 448 | ||
449 | error_tlv: | 449 | error_tlv: |
450 | pr_err("error %d\n", err); | 450 | if (err) |
451 | pr_err("error %d\n", err); | ||
451 | 452 | ||
452 | kfree(service_name_tlv); | 453 | kfree(service_name_tlv); |
453 | kfree(miux_tlv); | 454 | kfree(miux_tlv); |
@@ -495,10 +496,11 @@ int nfc_llcp_send_cc(struct nfc_llcp_sock *sock) | |||
495 | 496 | ||
496 | skb_queue_tail(&local->tx_queue, skb); | 497 | skb_queue_tail(&local->tx_queue, skb); |
497 | 498 | ||
498 | return 0; | 499 | err = 0; |
499 | 500 | ||
500 | error_tlv: | 501 | error_tlv: |
501 | pr_err("error %d\n", err); | 502 | if (err) |
503 | pr_err("error %d\n", err); | ||
502 | 504 | ||
503 | kfree(miux_tlv); | 505 | kfree(miux_tlv); |
504 | kfree(rw_tlv); | 506 | kfree(rw_tlv); |