mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-12 11:40:39 +03:00
option.c: memset the node when a new optlist node is created
memset the node when a new optlist node is created, because the node->next maybe not NULL, so if it creates a new optlist node, and delete it, and then create it again, error will be occurred
This commit is contained in:
1 parent
da254c1f8e
commit
e269b87151
1 file changed
+1
@@ -557,6 +557,7 @@ coap_new_optlist(uint16_t number,
|
||||
node = coap_malloc_type(COAP_OPTLIST, sizeof(coap_optlist_t) + length);
|
||||
|
||||
if (node) {
|
||||
memset(node, 0, (sizeof(coap_optlist_t) + length));
|
||||
node->number = number;
|
||||
node->length = length;
|
||||
node->data = (uint8_t *)&node[1];
|
||||
|
||||
Reference in new issue
Block a user