From cf5cd1520ea32d2b65712a36a105f396df07345c Mon Sep 17 00:00:00 2001 From: Sylvain Fonteneau Date: Thu, 28 Oct 2010 04:00:23 +0200 Subject: 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 --- src/phFriNfc_LlcpTransport.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/phFriNfc_LlcpTransport.c') 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 #include #include #include @@ -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 */ -- cgit v1.2.3