Skip to content

Commit f78f560

Browse files
author
Antti Yli-Tokola
committed
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
1 parent 590dfeb commit f78f560

File tree

3 files changed

+15
-17
lines changed

3 files changed

+15
-17
lines changed

features/frameworks/mbed-coap/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Change Log
22

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

features/frameworks/mbed-coap/module.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mbed-coap",
3-
"version": "4.6.0",
3+
"version": "4.6.1",
44
"description": "COAP library",
55
"keywords": [
66
"coap",

features/frameworks/mbed-coap/source/sn_coap_protocol.c

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -120,30 +120,17 @@ int8_t sn_coap_protocol_destroy(struct coap_s *handle)
120120
ns_list_foreach_safe(coap_blockwise_msg_s, tmp, &handle->linked_list_blockwise_sent_msgs) {
121121
if (tmp->coap == handle) {
122122
if (tmp->coap_msg_ptr) {
123-
if (tmp->coap_msg_ptr->payload_ptr) {
124-
handle->sn_coap_protocol_free(tmp->coap_msg_ptr->payload_ptr);
125-
tmp->coap_msg_ptr->payload_ptr = 0;
126-
}
123+
handle->sn_coap_protocol_free(tmp->coap_msg_ptr->payload_ptr);
127124
sn_coap_parser_release_allocated_coap_msg_mem(tmp->coap, tmp->coap_msg_ptr);
128125
}
129126
ns_list_remove(&handle->linked_list_blockwise_sent_msgs, tmp);
130127
handle->sn_coap_protocol_free(tmp);
131-
tmp = 0;
132128
}
133129
}
130+
134131
ns_list_foreach_safe(coap_blockwise_payload_s, tmp, &handle->linked_list_blockwise_received_payloads) {
135132
if (tmp->coap == handle) {
136-
if (tmp->addr_ptr) {
137-
handle->sn_coap_protocol_free(tmp->addr_ptr);
138-
tmp->addr_ptr = 0;
139-
}
140-
if (tmp->payload_ptr) {
141-
handle->sn_coap_protocol_free(tmp->payload_ptr);
142-
tmp->payload_ptr = 0;
143-
}
144-
ns_list_remove(&handle->linked_list_blockwise_received_payloads, tmp);
145-
handle->sn_coap_protocol_free(tmp);
146-
tmp = 0;
133+
sn_coap_protocol_linked_list_blockwise_payload_remove(handle, tmp);
147134
}
148135
}
149136
#endif
@@ -396,6 +383,9 @@ int8_t sn_coap_protocol_delete_retransmission_by_token(struct coap_s *handle, ui
396383

397384
int8_t prepare_blockwise_message(struct coap_s *handle, sn_coap_hdr_s *src_coap_msg_ptr)
398385
{
386+
(void) handle;
387+
(void) src_coap_msg_ptr;
388+
399389
#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 */
400390
if ((src_coap_msg_ptr->payload_len > SN_COAP_MAX_NONBLOCKWISE_PAYLOAD_SIZE) &&
401391
(src_coap_msg_ptr->payload_len > handle->sn_coap_block_data_size) &&

0 commit comments

Comments
 (0)