Commit f956a198 authored by Vitalii Irkha's avatar Vitalii Irkha

Static Analysis issues fixed

Change-Id: I556003eb0babcb08698466bc9acde2790c1d7916
Signed-off-by: default avatarVitalii Irkha <v.irkha@samsung.com>
parent 1f5dc564
......@@ -1497,7 +1497,11 @@ static int provisionCloudConfig(void)
// Install the CA trust anchor
FILE *F;
F = fopen("rootca.crt", "rb");
fseek (F , 0 , SEEK_END);
if(0 != fseek (F , 0 , SEEK_END))
{
printf(" Failed to operate with CA\n");
return -1;
}
int certsize = ftell (F);
rewind (F);
uint8_t* cert = (uint8_t*) malloc (sizeof(char)*certsize);
......@@ -1669,7 +1673,18 @@ static int getCloudStatus(void)
}
OicCloud_t *cloud = OICCalloc(1,sizeof(OicCloud_t));
if(NULL == cloud)
{
OIC_LOG(ERROR, TAG, "Error, invalid cloud");
return -1;
}
cloud->cis = OICCalloc(1,1024);
if(NULL == cloud->cis)
{
OIC_LOG(ERROR, TAG, "Error, invalid cloud->cis");
ret = -1;
goto exit;
}
snprintf(cloud->cis,13,"coaps+tcp://");
......
......@@ -397,10 +397,10 @@ static OCStackResult CloudToCBORPayloadInternal(const OicCloud_t *clouds, uint8_
#if !defined(__MANDATORY__)
if (NULL != cloud->redirectUri)
{
cbor_encode_text_string(&map, OIC_JSON_CLOUD_SESSION_REDIRECT_URL,
cborError = cbor_encode_text_string(&map, OIC_JSON_CLOUD_SESSION_REDIRECT_URL,
sizeof(OIC_JSON_CLOUD_SESSION_REDIRECT_URL) + 1);
VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborError, "Failed add tag: redirect uri");
cbor_encode_text_string(&map, cloud->redirectUri, strnlen(cloud->redirectUri, MAX_STR_LEN));
cborError = cbor_encode_text_string(&map, cloud->redirectUri, strnlen(cloud->redirectUri, MAX_STR_LEN));
VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborError, "Failed add value: redirect uri");
}
#endif // __MANDATORY__
......
......@@ -511,12 +511,19 @@ exit:
response.requestHandle = ehRequest ? ehRequest->requestHandle : NULL;
response.ehResult = ehRet;
response.payload = (OCPayload *)OCRepPayloadCreate();
response.payload->type = PAYLOAD_TYPE_REPRESENTATION;
response.persistentBufferFlag = 0;
if (OC_STACK_OK != OCDoResponse(&response))
if (NULL != response.payload)
{
OIC_LOG_V(ERROR, TAG, "%s: send response", __func__);
response.payload->type = PAYLOAD_TYPE_REPRESENTATION;
response.persistentBufferFlag = 0;
if (OC_STACK_OK != OCDoResponse(&response))
{
OIC_LOG_V(ERROR, TAG, "%s: send response", __func__);
ehRet = OC_EH_ERROR;
}
}
else
{
OIC_LOG_V(ERROR, TAG, "%s: response payload is NULL", __func__);
ehRet = OC_EH_ERROR;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment