OICFree( cred->privateData.data );
cred->privateData.data = (uint8_t *)OICCalloc(1, outSize + 1);
- VERIFY_NON_NULL(TAG, cred->privateData.data, ERROR);
+ if (cred->privateData.data == NULL)
+ {
+ OICFree(b64Buf);
+ res = OC_STACK_ERROR;
+ goto exit;
+ }
strncpy((char*)(cred->privateData.data), b64Buf, outSize);
cred->privateData.data[outSize] = '\0';
if (OC_STACK_RESOURCE_CHANGED == clientResponse->result)
{
OIC_LOG(INFO, TAG, "Device state is in Ready for Normal Operation.");
+ OTMStop(&otmCtx->selectedDeviceInfo->doxm->deviceID);
OCStackResult res = PDMSetDeviceState(&otmCtx->selectedDeviceInfo->doxm->deviceID,
PDM_DEVICE_ACTIVE);
if (OC_STACK_OK == res)
if(!ownerCredential)
{
OIC_LOG(ERROR, TAG, "Can not find OwnerPSK.");
+ OICFree(secPayload);
return OC_STACK_NO_RESOURCE;
}
memcpy(&(selectedDevice->doxm->owner), &emptyOwner, sizeof(OicUuid_t));
}
+ OicUuid_t ownerUuid = {0};
+ GetDoxmDevOwnerId(&ownerUuid);
+
+ res = OTMStart(&selectedDevice->doxm->deviceID, &ownerUuid);
+ if(OC_STACK_OK != res)
+ {
+ if(OC_STACK_DUPLICATE_UUID == res)
+ {
+ return res;
+ }
+ OIC_LOG_V(ERROR, TAG, "%s OTMStart error : %d", __func__, res);
+ }
+
//Setup PDM to perform the OTM, PDM will be cleanup if necessary.
res = SetupPDM(selectedDevice);
if(OC_STACK_OK != res)
OTMContext_t* otmCtx = (OTMContext_t*)ctx;
otmCtx->selectedDeviceInfo = selectedDevice;
+ OicUuid_t ownerUuid = {0};
+ GetDoxmDevOwnerId(&ownerUuid);
+
+ res = OTMStart(&selectedDevice->doxm->deviceID, &ownerUuid);
+ if(OC_STACK_OK != res)
+ {
+ if(OC_STACK_DUPLICATE_UUID == res)
+ {
+ return res;
+ }
+ OIC_LOG_V(ERROR, TAG, "%s OTMStart error : %d", __func__, res);
+ }
+
//Setup PDM to perform the OTM, PDM will be cleanup if necessary.
res = SetupPDM(selectedDevice);
if(OC_STACK_OK != res)