summaryrefslogtreecommitdiff
path: root/src/phFriNfc_LlcpTransport.c
diff options
context:
space:
mode:
authorSylvain Fonteneau <sylvain.fonteneau@trusted-logic.com>2010-10-28 04:00:23 +0200
committerNick Pelly <npelly@google.com>2010-10-28 10:13:06 -0700
commitcf5cd1520ea32d2b65712a36a105f396df07345c (patch)
tree6047e8487d8e95e087c8c106364faacf52f8f11d /src/phFriNfc_LlcpTransport.c
parent99eeb8ab747ce32a0b99a9abfe1c06eb6d583abc (diff)
downloadlibnfc-nxp-cf5cd1520ea32d2b65712a36a105f396df07345c.tar.gz
Fixed LLCP Service Name matching failure.
Service Name is now copied in the libnfc to avoid referencing a pointer that may not be valid during the whole socket life. Change-Id: I6572366ac51502d189cc8f1350fa089c11cc2bea
Diffstat (limited to 'src/phFriNfc_LlcpTransport.c')
-rw-r--r--src/phFriNfc_LlcpTransport.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/phFriNfc_LlcpTransport.c b/src/phFriNfc_LlcpTransport.c
index 55a3f15..523a6bd 100644
--- a/src/phFriNfc_LlcpTransport.c
+++ b/src/phFriNfc_LlcpTransport.c
@@ -23,6 +23,7 @@
*/
/*include files*/
+#include <phOsalNfc.h>
#include <phLibNfcStatus.h>
#include <phLibNfc.h>
#include <phNfcLlcpTypes.h>
@@ -171,7 +172,6 @@ NFCSTATUS phFriNfc_LlcpTransport_Reset (phFriNfc_LlcpTransport_t *pLlcpTran
pLlcpTransport->pSocketTable[i].pfSocketListen_Cb = NULL;
pLlcpTransport->pSocketTable[i].pfSocketConnect_Cb = NULL;
pLlcpTransport->pSocketTable[i].pfSocketDisconnect_Cb = NULL;
- pLlcpTransport->pSocketTable[i].pServiceName = NULL;
pLlcpTransport->pSocketTable[i].socket_VS = 0;
pLlcpTransport->pSocketTable[i].socket_VSA = 0;
pLlcpTransport->pSocketTable[i].socket_VR = 0;
@@ -183,6 +183,12 @@ NFCSTATUS phFriNfc_LlcpTransport_Reset (phFriNfc_LlcpTransport_t *pLlcpTran
pLlcpTransport->pSocketTable[i].index = 0;
pLlcpTransport->pSocketTable[i].indexRwRead = 0;
pLlcpTransport->pSocketTable[i].indexRwWrite = 0;
+
+ if (pLlcpTransport->pSocketTable[i].sServiceName.buffer != NULL) {
+ phOsalNfc_FreeMemory(pLlcpTransport->pSocketTable[i].sServiceName.buffer);
+ }
+ pLlcpTransport->pSocketTable[i].sServiceName.buffer = NULL;
+ pLlcpTransport->pSocketTable[i].sServiceName.length = 0;
}
/* Start The Receive Loop */