OCStackResult SendAclReq(PEContext_t *context, OCDevAddr *devAddr, OCConnectivityType connType,
uint16_t securedPort);
-
-/*
- * Cleanup CARequestInfo_t object
- * @param requestInfo pointer to RequestInfo_t object
- */
-void FreeCARequestInfo(CARequestInfo_t *requestInfo);
-
-
/*
* This method is used by Policy engine to checks Amacl resource.
* If Amacl is found then it fills up context->amsMgrContext->amsDeviceId
{
OCStackResult ret = OC_STACK_ERROR;
+ if (!context->amsMgrContext)
+ {
+ goto exit;
+ }
+
//The AmsMgr context endpoint and requestInfo will be free from ,
//AmsMgrAclReqCallback function
if(context->amsMgrContext->endpoint)
void FreeCARequestInfo(CARequestInfo_t *requestInfo)
{
- if(NULL == requestInfo)
+ if (NULL == requestInfo)
{
- OIC_LOG_V(ERROR, TAG, "%s: Can't free memory. Received NULL requestInfo", __func__);
+ OIC_LOG_V(DEBUG, TAG, "%s: Can't free memory. Received NULL requestInfo", __func__);
return;
}
OICFree(requestInfo->info.token);
context->amsProcessing = false;
context->retVal = ACCESS_DENIED_POLICY_ENGINE_ERROR;
- FreeCARequestInfo(context->amsMgrContext->requestInfo);
- OICFree(context->amsMgrContext->endpoint);
- memset(context->amsMgrContext, 0, sizeof(AmsMgrContext_t));
+ if (context->amsMgrContext)
+ {
+ if (context->amsMgrContext->requestInfo)
+ {
+ FreeCARequestInfo(context->amsMgrContext->requestInfo);
+ }
+ OICFree(context->amsMgrContext->endpoint);
+ memset(context->amsMgrContext, 0, sizeof(AmsMgrContext_t));
+ }
// Set state.
context->state = state;