}
OICFree(ace->resources);
- //Clean Period & Recurrence
- for(i = 0; i < ace->prdRecrLen; i++)
+ //Clean Period
+ if(ace->periods)
{
- OICFree(ace->periods[i]);
- OICFree(ace->recurrences[i]);
+ for(i = 0; i < ace->prdRecrLen; i++)
+ {
+ OICFree(ace->periods[i]);
+ }
+ OICFree(ace->periods);
+ }
+
+ //Clean Recurrence
+ if(ace->recurrences)
+ {
+ for(i = 0; i < ace->prdRecrLen; i++)
+ {
+ OICFree(ace->recurrences[i]);
+ }
+ OICFree(ace->recurrences);
}
- OICFree(ace->periods);
- OICFree(ace->recurrences);
// Clean Owners
OICFree(ace->owners);
{
VERIFY_SUCCESS(TAG, cJSON_Array == jsonRecurObj->type,
ERROR);
+
if(acl->prdRecrLen > 0)
{
acl->recurrences = (char**)OICCalloc(acl->prdRecrLen,
for(size_t i = 0; i < acl->prdRecrLen; i++)
{
jsonRecur = cJSON_GetArrayItem(jsonRecurObj, i);
+ VERIFY_NON_NULL(TAG, jsonRecur, ERROR);
jsonObjLen = strlen(jsonRecur->valuestring) + 1;
acl->recurrences[i] = (char*)OICMalloc(jsonObjLen);
VERIFY_NON_NULL(TAG, acl->recurrences[i], ERROR);
OICStrcpy(acl->recurrences[i], jsonObjLen,
- jsonRecur->valuestring);
+ jsonRecur->valuestring);
}
}
}