From c14343aa7d840cdc0b621d2536c2497b47190ca7 Mon Sep 17 00:00:00 2001 From: Deepak Venugopal Date: Fri, 28 Sep 2018 11:03:35 +0300 Subject: [PATCH] valgrind and coverity reported errors fixed. (#1838) Coverity CID: 277994 fixed. --- source/6LoWPAN/Thread/thread_extension.c | 5 ++++- source/6LoWPAN/Thread/thread_extension_bbr.c | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/source/6LoWPAN/Thread/thread_extension.c b/source/6LoWPAN/Thread/thread_extension.c index f4343983eb5..9affd77b2be 100644 --- a/source/6LoWPAN/Thread/thread_extension.c +++ b/source/6LoWPAN/Thread/thread_extension.c @@ -626,8 +626,11 @@ void thread_extension_address_registration(struct protocol_interface_info_entry void thread_extension_dua_address_generate(protocol_interface_info_entry_t *cur, uint8_t *domain_prefix, uint8_t domain_prefix_len) { if_address_entry_t *def_address = NULL; - addr_delete_matching(cur, NULL, 0, ADDR_SOURCE_THREAD_DOMAIN); uint8_t domain_address[16]; + if (!thread_extension_version_check(thread_info(cur)->version)) { + return; + } + addr_delete_matching(cur, NULL, 0, ADDR_SOURCE_THREAD_DOMAIN); memcpy(domain_address, domain_prefix, 8); def_address = icmpv6_slaac_address_add(cur, domain_address, domain_prefix_len, 0xffffffff, 0xffffffff, true, SLAAC_IID_DEFAULT); if (def_address) { diff --git a/source/6LoWPAN/Thread/thread_extension_bbr.c b/source/6LoWPAN/Thread/thread_extension_bbr.c index d51fb277375..e86c9749ec5 100644 --- a/source/6LoWPAN/Thread/thread_extension_bbr.c +++ b/source/6LoWPAN/Thread/thread_extension_bbr.c @@ -873,6 +873,9 @@ static int thread_extension_bbr_dua_cb(int8_t service_id, uint8_t source_address } */ protocol_interface_info_entry_t *cur = protocol_stack_interface_info_get_by_id(this->interface_id); + if (!cur) { + return -1; + } if (0 == thread_extension_primary_bbr_get(cur, bbr_rloc_addr, NULL, NULL, NULL) && !addr_get_entry(cur,bbr_rloc_addr)) { // Primary pBBR present and I am not the pBBR