case CA_BAD_OPT:
case CA_FORBIDDEN_REQ:
case CA_NOT_FOUND:
+ case CA_METHOD_NOT_ALLOWED:
case CA_NOT_ACCEPTABLE:
case CA_REQUEST_ENTITY_INCOMPLETE:
case CA_REQUEST_ENTITY_TOO_LARGE:
case CA_INTERNAL_SERVER_ERROR:
+ case CA_NOT_IMPLEMENTED:
+ case CA_BAD_GATEWAY:
+ case CA_SERVICE_UNAVAILABLE:
case CA_RETRANSMIT_TIMEOUT:
+ case CA_PROXY_NOT_SUPPORTED:
break;
default:
OIC_LOG_V(ERROR, TAG, "Response code %u is invalid", rep->result);
//Do not free clone. we cannot declare it const, as the content is modified
if ((info->token) && (0 < info->tokenLength))
{
- char *temp = NULL;
-
// allocate token field
uint8_t len = info->tokenLength;
- temp = (char *) OICMalloc(len * sizeof(char));
+ char *temp = (char *) OICMalloc(len * sizeof(char));
if (!temp)
{
OIC_LOG(ERROR, TAG, "CACloneInfo Out of memory");
- return CA_MEMORY_ALLOC_FAILED;
+ goto exit;
}
memcpy(temp, info->token, len);
if (!clone->options)
{
OIC_LOG(ERROR, TAG, "CACloneInfo Out of memory");
- CADestroyInfoInternal(clone);
- return CA_MEMORY_ALLOC_FAILED;
+ goto exit;
}
memcpy(clone->options, info->options, sizeof(CAHeaderOption_t) * info->numOptions);
clone->numOptions = info->numOptions;
if (!temp)
{
OIC_LOG(ERROR, TAG, "CACloneInfo Out of memory");
- CADestroyInfoInternal(clone);
- return CA_MEMORY_ALLOC_FAILED;
+ goto exit;
}
memcpy(temp, info->payload, info->payloadSize);
if (!temp)
{
OIC_LOG(ERROR, TAG, "CACloneInfo Out of memory");
- CADestroyInfoInternal(clone);
- return CA_MEMORY_ALLOC_FAILED;
+ goto exit;
}
// save the resourceUri
return CA_STATUS_OK;
+exit:
+ CADestroyInfoInternal(clone);
+ return CA_MEMORY_ALLOC_FAILED;
}