Update mbed-coap to version 4.6.1

Fixes error: IOTCLT-2900 - Blockwise handling leaking memory in some error cases
* Fix memory leak when clearing blockwise payload list
* Token was not freed from the list when closing down the library

Fix unused parameter - warning when blockwise is not used
pull/7739/head
Antti Yli-Tokola 2018-08-15 11:20:56 +03:00
parent 590dfeb1f9
commit f78f5601e5
3 changed files with 15 additions and 17 deletions

View File

@ -1,5 +1,13 @@
# Change Log # Change Log
## [v4.6.1](https://github.com/ARMmbed/mbed-coap/releases/tag/v4.6.1)
**Closed issues:**
- IOTCLT-2900 - Blockwise handling leaking memory in some error cases
Fix unused parameter compiler warning when blockwise is not used.
-[Full Changelog](https://github.com/ARMmbed/mbed-coap/compare/v4.6.0...v4.6.1)
## [v4.6.0](https://github.com/ARMmbed/mbed-coap/releases/tag/v4.6.0) ## [v4.6.0](https://github.com/ARMmbed/mbed-coap/releases/tag/v4.6.0)
**New feature:** **New feature:**
- Add new API which clears one item from the resend queue based on token - Add new API which clears one item from the resend queue based on token

View File

@ -1,6 +1,6 @@
{ {
"name": "mbed-coap", "name": "mbed-coap",
"version": "4.6.0", "version": "4.6.1",
"description": "COAP library", "description": "COAP library",
"keywords": [ "keywords": [
"coap", "coap",

View File

@ -120,30 +120,17 @@ int8_t sn_coap_protocol_destroy(struct coap_s *handle)
ns_list_foreach_safe(coap_blockwise_msg_s, tmp, &handle->linked_list_blockwise_sent_msgs) { ns_list_foreach_safe(coap_blockwise_msg_s, tmp, &handle->linked_list_blockwise_sent_msgs) {
if (tmp->coap == handle) { if (tmp->coap == handle) {
if (tmp->coap_msg_ptr) { if (tmp->coap_msg_ptr) {
if (tmp->coap_msg_ptr->payload_ptr) { handle->sn_coap_protocol_free(tmp->coap_msg_ptr->payload_ptr);
handle->sn_coap_protocol_free(tmp->coap_msg_ptr->payload_ptr);
tmp->coap_msg_ptr->payload_ptr = 0;
}
sn_coap_parser_release_allocated_coap_msg_mem(tmp->coap, tmp->coap_msg_ptr); sn_coap_parser_release_allocated_coap_msg_mem(tmp->coap, tmp->coap_msg_ptr);
} }
ns_list_remove(&handle->linked_list_blockwise_sent_msgs, tmp); ns_list_remove(&handle->linked_list_blockwise_sent_msgs, tmp);
handle->sn_coap_protocol_free(tmp); handle->sn_coap_protocol_free(tmp);
tmp = 0;
} }
} }
ns_list_foreach_safe(coap_blockwise_payload_s, tmp, &handle->linked_list_blockwise_received_payloads) { ns_list_foreach_safe(coap_blockwise_payload_s, tmp, &handle->linked_list_blockwise_received_payloads) {
if (tmp->coap == handle) { if (tmp->coap == handle) {
if (tmp->addr_ptr) { sn_coap_protocol_linked_list_blockwise_payload_remove(handle, tmp);
handle->sn_coap_protocol_free(tmp->addr_ptr);
tmp->addr_ptr = 0;
}
if (tmp->payload_ptr) {
handle->sn_coap_protocol_free(tmp->payload_ptr);
tmp->payload_ptr = 0;
}
ns_list_remove(&handle->linked_list_blockwise_received_payloads, tmp);
handle->sn_coap_protocol_free(tmp);
tmp = 0;
} }
} }
#endif #endif
@ -396,6 +383,9 @@ int8_t sn_coap_protocol_delete_retransmission_by_token(struct coap_s *handle, ui
int8_t prepare_blockwise_message(struct coap_s *handle, sn_coap_hdr_s *src_coap_msg_ptr) int8_t prepare_blockwise_message(struct coap_s *handle, sn_coap_hdr_s *src_coap_msg_ptr)
{ {
(void) handle;
(void) src_coap_msg_ptr;
#if SN_COAP_BLOCKWISE_ENABLED || SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE /* If Message blockwising is not enabled, this part of code will not be compiled */ #if SN_COAP_BLOCKWISE_ENABLED || SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE /* If Message blockwising is not enabled, this part of code will not be compiled */
if ((src_coap_msg_ptr->payload_len > SN_COAP_MAX_NONBLOCKWISE_PAYLOAD_SIZE) && if ((src_coap_msg_ptr->payload_len > SN_COAP_MAX_NONBLOCKWISE_PAYLOAD_SIZE) &&
(src_coap_msg_ptr->payload_len > handle->sn_coap_block_data_size) && (src_coap_msg_ptr->payload_len > handle->sn_coap_block_data_size) &&