summaryrefslogtreecommitdiffstats
path: root/src/phFriNfc_Llcp.c
diff options
context:
space:
mode:
authorArnaud Ferir <arnaud.ferir@trusted-logic.com>2011-01-05 14:16:55 +0100
committerNick Pelly <npelly@google.com>2011-01-18 13:23:10 -0800
commit40cdab11e00d801c1b9acfdcfe53455059c1b557 (patch)
tree15ee6a6974e72886c5e5719b09506330b8347cc5 /src/phFriNfc_Llcp.c
parent76270e7c32ec0c558907430e756712d5b68b417c (diff)
downloadexternal_libnfc-nxp-40cdab11e00d801c1b9acfdcfe53455059c1b557.zip
external_libnfc-nxp-40cdab11e00d801c1b9acfdcfe53455059c1b557.tar.gz
external_libnfc-nxp-40cdab11e00d801c1b9acfdcfe53455059c1b557.tar.bz2
Fixed memory handling in LLCP link layer.
Check that internal allocated buffer is not NULL before deallocating it and make sure the pointer is resetted to NULL. Change-Id: I4212489c8661c7a8dff8ef352029100ec5ab157e
Diffstat (limited to 'src/phFriNfc_Llcp.c')
-rw-r--r--src/phFriNfc_Llcp.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/phFriNfc_Llcp.c b/src/phFriNfc_Llcp.c
index ab9b768..d7dbe31 100644
--- a/src/phFriNfc_Llcp.c
+++ b/src/phFriNfc_Llcp.c
@@ -136,7 +136,14 @@ static void phFriNfc_Llcp_Deallocate(phNfc_sData_t * pData)
{
if (pData != NULL)
{
- phOsalNfc_FreeMemory(pData->buffer);
+ if (pData->buffer != NULL)
+ {
+ phOsalNfc_FreeMemory(pData->buffer);
+ }
+ else
+ {
+ LLCP_PRINT("Warning, deallocating empty buffer");
+ }
phOsalNfc_FreeMemory(pData);
}
}
@@ -160,6 +167,7 @@ static NFCSTATUS phFriNfc_Llcp_InternalDeactivate( phFriNfc_Llcp_t *Llcp )
if (Llcp->psSendInfo != NULL)
{
phFriNfc_Llcp_Deallocate(Llcp->psSendInfo);
+ Llcp->psSendInfo = NULL;
Llcp->psSendHeader = NULL;
Llcp->psSendSequence = NULL;
}