Skip to content

Commit

Permalink
Minor changes from review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
aggarw13 committed Nov 15, 2019
1 parent b30e691 commit 3dbf4c9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
7 changes: 4 additions & 3 deletions demos/src/aws_iot_demo_onboarding.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
/**
* @brief Type for the context parameter for the #AwsIotOnboarding_DeviceCredentialsCallbackInfo_t callback.
* It will be used for storing the received Certificate ID and the ownership token data received from the server through
* the callback, so that that can be used for provisioning the demo application.
* the callback, so that can be used for provisioning the demo application.
*/
typedef struct _demoDeviceCredentialsCallbackContext
{
Expand Down Expand Up @@ -496,9 +496,10 @@ int RunOnboardingDemo( bool awsIotMqttMode,
IotLogError( "Request to get new credentials failed, error %s ",
AwsIotOnboarding_strerror( requestStatus ) );
}
else if( newCertificateDataContext.pCertificateIdBuffer == NULL )
else if( ( newCertificateDataContext.pCertificateIdBuffer == NULL ) ||
( newCertificateDataContext.pCertificateOwnershipToken == NULL ) )
{
IotLogInfo( "Don't have the Certificate ID to proceed for onboarding. So exiting...!" );
IotLogInfo( "Don't have either the Certificate ID OR the Certificate Ownership Token (or both) to proceed with provisioning. So exiting...!" );
}
else
{
Expand Down
7 changes: 5 additions & 2 deletions libraries/aws/onboarding/src/aws_iot_onboarding_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,15 +455,18 @@ AwsIotOnboardingError_t _AwsIotOnboarding_ParseOnboardDeviceResponse( AwsIotStat
if( ( deviceConfigInnerKeyDecoder.type != IOT_SERIALIZER_SCALAR_TEXT_STRING ) ||
( deviceConfigInnerValueDecoder.type != IOT_SERIALIZER_SCALAR_TEXT_STRING ) )
{
/** Opportunity for HYGENE! The serializer library allocates memory for the iterator. It can
/**The serializer library allocates memory for the iterator. It can
* only be released by iterating to the last element in the map containers and "stepping out" of
* the container
* Thus, we will iterate to the end of the device configuration container to invalidate the
* iterator. */
while( ++configurationListIndex < numOfDeviceConfigurationEntries )
size_t nextConfigEntryIndex = configurationListIndex + 1;

while( nextConfigEntryIndex < numOfDeviceConfigurationEntries )
{
_pAwsIotOnboardingDecoder->next( deviceConfigIter );
_pAwsIotOnboardingDecoder->next( deviceConfigIter );
nextConfigEntryIndex++;
}

/* Advance to the "end" of the container. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static const AwsIotOnboardingRequestParameterEntry_t _pTestParameters[] =
/**
* @brief Type for the context parameter for the #AwsIotOnboarding_DeviceCredentialsCallbackInfo_t callback.
* It will be used for storing the received Certificate ID and the ownership token data received from the server through
* the callback, so that that can be used for provisioning the demo application.
* the callback, so that can be used for provisioning the demo application.
*/
typedef struct _deviceCredentialsCallbackContext
{
Expand Down

0 comments on commit 3dbf4c9

Please sign in to comment.