From e269b871510c8939e830beb9bbcfee89589eebe3 Mon Sep 17 00:00:00 2001 From: yr2004 Date: Tue, 26 Feb 2019 14:52:17 +0800 Subject: [PATCH] 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 --- src/option.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/option.c b/src/option.c index 2686e605..84a3127b 100644 --- a/src/option.c +++ b/src/option.c @@ -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];