}
}
-void printCrl(OicSecCrl_t *crl)
+void printCrl(const OicSecCrl_t *crl)
{
if (NULL == crl)
{
ret = OC_STACK_OK;
exit:
- if ((CborErrorOutOfMemory == cborEncoderResult) && (cborLen < CBOR_MAX_SIZE))
- {
- // reallocate and try again!
- OICFree(outPayload);
- // Since the allocated initial memory failed, double the memory.
- cborLen += cbor_encoder_get_buffer_size(&encoder, encoder.end);
- cborEncoderResult = CborNoError;
- ret = CrlToCBORPayload(crl, payload, &cborLen, lastUpdate);
- }
-
if ((CborNoError != cborEncoderResult) || (OC_STACK_OK != ret))
{
OICFree(outPayload);
*payload = NULL;
*size = 0;
ret = OC_STACK_ERROR;
+ if ((CborErrorOutOfMemory == cborEncoderResult) && (cborLen < CBOR_MAX_SIZE))
+ {
+ // Since the allocated initial memory failed, double the memory.
+ cborLen += cbor_encoder_get_buffer_size(&encoder, encoder.end);
+ cborEncoderResult = CborNoError;
+ ret = CrlToCBORPayload(crl, payload, &cborLen, lastUpdate);
+ }
}
return ret;
{
OIC_LOG (ERROR, TAG, "Base64 decoding failed.");
}
+ OICFree(out);
}
out->len = 0;
- char *str = "Can't allocate memory for out->data";
- out->data = OICMalloc(crl->len);
+ out->data = OICRealloc(out->data, crl->len);
if (out->data)
{
memcpy(out->data, crl->data, crl->len);
}
else
{
- OIC_LOG_V(ERROR, TAG, "%s", str);
+ OIC_LOG(ERROR, TAG, "Can't allocate memory for out->data");
}
DeleteCrl(crlRes);
}