mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-23 15:41:04 +03:00
options: Fix subtle memory leak in coap_add_optlist_pdu()
coap_add_optlist_pdu() sorted the options for insertion, but did not update the coap_optlist_t head (whch may then no longer point to the first entry in the sorted chain) and so when coap_delete_optlist() was called, the first few entries of the sorted chain may not get deleted. Fixed by making it coap_add_optlist_pdu(coap_pdu_t *pdu, coap_optlist_t** optlist_chain) instead of coap_add_optlist_pdu(coap_pdu_t *pdu, coap_optlist_t* optlist_chain) Additionally deleted options_start() and options_next() as they are not required - Issue #184. examples/client.c: Fix coap_add_optlist_pdu() call include/coap/options.h: Fix coap_add_optlist_pdu() call libcoap-2.{map|sym}: Delete options_start() man/coap_observe.txt.in: man/coap_pdu_setup.txt.in: Update docmentation src/option.c: Update coap_add_optlist_pdu() tests/test_pdu.c: New tests for checkout out coap_insert_optlist() and coap_add_optlist_pdu() functions
This commit is contained in:
1 parent
232f2612f2
commit
9fa448e439
6 files changed
+120
-36
No files matched your search
+1
-1
@@ -147,7 +147,7 @@ coap_new_request(coap_context_t *ctx,
|
||||
}
|
||||
|
||||
if (options)
|
||||
coap_add_optlist_pdu(pdu, *options);
|
||||
coap_add_optlist_pdu(pdu, options);
|
||||
|
||||
if (length) {
|
||||
if ((flags & FLAGS_BLOCK) == 0)
|
||||
|
||||
Reference in new issue
Block a user