From: Szymon Janc Date: Sat, 30 Nov 2013 15:14:57 +0000 (+0100) Subject: NFC: llcp: Fix possible memory leak while sending I frames X-Git-Tag: v4.0~2533^2~3^2^2~44^2~16 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=43d53c29dd8548404256c05573ff557c927d214b;p=platform%2Fkernel%2Flinux-amlogic.git NFC: llcp: Fix possible memory leak while sending I frames If sending was not completed due to low memory condition msg_data was not free before returning from function. Signed-off-by: Szymon Janc Signed-off-by: Samuel Ortiz --- diff --git a/net/nfc/llcp_commands.c b/net/nfc/llcp_commands.c index 693cd1a..80057a8 100644 --- a/net/nfc/llcp_commands.c +++ b/net/nfc/llcp_commands.c @@ -684,8 +684,10 @@ int nfc_llcp_send_i_frame(struct nfc_llcp_sock *sock, pdu = llcp_allocate_pdu(sock, LLCP_PDU_I, frag_len + LLCP_SEQUENCE_SIZE); - if (pdu == NULL) + if (pdu == NULL) { + kfree(msg_data); return -ENOMEM; + } skb_put(pdu, LLCP_SEQUENCE_SIZE);