Remove dynamically allocated memory usage in NCI INIT command buffer
Dynamically allocated memory for NCI2.0 was never freed causing a memory leak. It was caught by running AppVerifier on a driver.
This commit is contained in:
Родитель
60ee4b65f6
Коммит
9830976a5d
|
@ -241,7 +241,8 @@ phNciNfc_Initialise(
|
|||
{
|
||||
pNciContext->ResetInfo.ResetTypeReq = eResetType;
|
||||
/* Init payload to display the build number in the init response */
|
||||
pNciContext->tInitInfo.bExtension = 0x00;
|
||||
pNciContext->tInitInfo.bExtension[0] = 0x00;
|
||||
pNciContext->tInitInfo.bExtension[1] = 0x00;
|
||||
pNciContext->tInitInfo.bSkipRegisterAllNtfs = 0x00;
|
||||
wStatus = phNciNfc_GenericSequence((void *)pNciContext, NULL, NFCSTATUS_SUCCESS);
|
||||
if(NFCSTATUS_PENDING != wStatus)
|
||||
|
@ -293,7 +294,8 @@ phNciNfc_ReInitialise(void* pNciHandle,
|
|||
phNciNfc_SetUpperLayerCallback(pNciContext, pReInitNotifyCb, pContext);
|
||||
pNciContext->ResetInfo.ResetTypeReq = phNciNfc_ResetType_KeepConfig;
|
||||
/* Init payload to display the build number in the init response */
|
||||
pNciContext->tInitInfo.bExtension = 0x00;
|
||||
pNciContext->tInitInfo.bExtension[0] = 0x00;
|
||||
pNciContext->tInitInfo.bExtension[1] = 0x00;
|
||||
pNciContext->tInitInfo.bSkipRegisterAllNtfs = 0x01;
|
||||
PHNCINFC_INIT_SEQUENCE(pNciContext, gphNciNfc_InitSequence);
|
||||
wStatus = phNciNfc_GenericSequence((void *)pNciContext, NULL, NFCSTATUS_SUCCESS);
|
||||
|
|
|
@ -80,7 +80,7 @@ typedef struct phNciNfc_ResetInfo
|
|||
|
||||
typedef struct phNciNfc_InitInfo
|
||||
{
|
||||
uint8_t bExtension; /**< NCI extension to get Build Number in Init response */
|
||||
uint8_t bExtension[2]; /**< "Feature Enable" NCI2.0, 4.2, Table 8: Control Messages to Initialize the NFCC*/
|
||||
uint8_t bSkipRegisterAllNtfs; /**< Skip registration of all ntfs as they are already registered */
|
||||
}phNciNfc_InitInfo_t, *pphNciNfc_InitInfo_t; /**< pointer to #phNciNfc_InitInfo_t */
|
||||
|
||||
|
|
|
@ -104,17 +104,8 @@ static NFCSTATUS phNciNfc_Init(void *pContext)
|
|||
TxInfo.tHeaderInfo.Group_ID = phNciNfc_e_CoreNciCoreGid;
|
||||
TxInfo.tHeaderInfo.Opcode_ID.OidType.NciCoreCmdOid = phNciNfc_e_NciCoreInitCmdOid;
|
||||
|
||||
if (phNciNfc_IsVersion2x(pNciContext))
|
||||
{
|
||||
TxInfo.Buff = (uint8_t *)phOsalNfc_GetMemory(2);
|
||||
TxInfo.wLen = 2;
|
||||
phOsalNfc_SetMemory(TxInfo.Buff, 0x00, TxInfo.wLen);
|
||||
}
|
||||
else
|
||||
{
|
||||
TxInfo.Buff = (uint8_t *)&pNciContext->tInitInfo.bExtension;
|
||||
TxInfo.wLen = 0;
|
||||
}
|
||||
TxInfo.Buff = (uint8_t *)pNciContext->tInitInfo.bExtension;
|
||||
TxInfo.wLen = phNciNfc_IsVersion2x(pNciContext) ? 2 : 0;
|
||||
|
||||
wStatus = phNciNfc_CoreIfTxRx(&(pNciContext->NciCoreContext),
|
||||
&TxInfo,
|
||||
|
|
Загрузка…
Ссылка в новой задаче