#define CA_BUFSIZE (128)
#define CA_PDU_MIN_SIZE (4)
-#define CA_PORT_BUFFER_SIZE (4)
+#define CA_ENCODE_BUFFER_SIZE (4)
static const char COAP_URI_HEADER[] = "coap://[::]/";
if (uri.port != COAP_DEFAULT_PORT)
{
- unsigned char portbuf[CA_PORT_BUFFER_SIZE] = { 0 };
+ unsigned char portbuf[CA_ENCODE_BUFFER_SIZE] = { 0 };
int ret = coap_insert(optlist,
CACreateNewOptionNode(COAP_OPTION_URI_PORT,
coap_encode_var_bytes(portbuf, uri.port),
if (CA_FORMAT_UNDEFINED != info->payloadFormat)
{
coap_list_t* node = NULL;
- uint8_t buf[3] = {0};
+ uint8_t buf[CA_ENCODE_BUFFER_SIZE] = {0};
switch (info->payloadFormat)
{
case CA_FORMAT_APPLICATION_CBOR:
node = CACreateNewOptionNode(
COAP_OPTION_CONTENT_FORMAT,
- coap_encode_var_bytes(buf, (uint16_t)COAP_MEDIATYPE_APPLICATION_CBOR),
+ coap_encode_var_bytes(buf, (unsigned short)COAP_MEDIATYPE_APPLICATION_CBOR),
(char *)buf);
break;
default:
if (CA_FORMAT_UNDEFINED != info->acceptFormat)
{
coap_list_t* node = NULL;
- uint8_t buf[3] = {0};
+ uint8_t buf[CA_ENCODE_BUFFER_SIZE] = {0};
switch (info->acceptFormat)
{
case CA_FORMAT_APPLICATION_CBOR:
node = CACreateNewOptionNode(
COAP_OPTION_ACCEPT,
- coap_encode_var_bytes(buf, (uint16_t)COAP_MEDIATYPE_APPLICATION_CBOR),
+ coap_encode_var_bytes(buf, (unsigned short)COAP_MEDIATYPE_APPLICATION_CBOR),
(char *)buf);
break;
default:
}
u_arraylist_remove(caglobals.tcp.svrlist, index);
OICFree(svritem->recvData);
- OICFree(svritem);
- ca_mutex_unlock(g_mutexObjectList);
// pass the connection information to RI for keepalive.
if (g_keepaliveCallback)
g_keepaliveCallback(svritem->sep.endpoint.addr, svritem->sep.endpoint.port, false);
}
+ OICFree(svritem);
+ ca_mutex_unlock(g_mutexObjectList);
+
return CA_STATUS_OK;
}