NFC: llcp: Fix 2 memory leaks
authorThierry Escande <thierry.escande@collabora.com>
Wed, 29 Jun 2016 08:48:23 +0000 (10:48 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Wed, 6 Jul 2016 08:02:06 +0000 (10:02 +0200)
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>
net/nfc/llcp_commands.c

index 4112d009b032c25e5eb409170d76b8d2486cdffb..c5959ce503e6c857c98d5cb7583f48b42b3eac71 100644 (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);
This page took 0.026543 seconds and 5 git commands to generate.