From 04946065e469d8b33757e55072d32133e533be11 Mon Sep 17 00:00:00 2001 From: Juha Heiskanen Date: Thu, 19 Dec 2019 11:03:32 +0200 Subject: [PATCH] Adapatation layer unicast list entry free update Added new parameter for reject fragmented buffer unnesessary free. Change-Id: Ifa5bd09ea7759aa4fb942d59d7d5d273e85ff4e9 --- source/6LoWPAN/adaptation_interface.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/source/6LoWPAN/adaptation_interface.c b/source/6LoWPAN/adaptation_interface.c index 73ca406e541..c4fd8fe536f 100644 --- a/source/6LoWPAN/adaptation_interface.c +++ b/source/6LoWPAN/adaptation_interface.c @@ -328,10 +328,14 @@ static void lowpan_list_entry_free(fragmenter_tx_list_t *list, fragmenter_tx_ent ns_dyn_mem_free(entry); } -static void lowpan_list_free(fragmenter_tx_list_t *list) +static void lowpan_list_free(fragmenter_tx_list_t *list, bool fragment_buf_free) { while (!ns_list_is_empty(list)) { fragmenter_tx_entry_t *entry = ns_list_get_first(list); + if (!fragment_buf_free) { + //We can't free this pointer becuase it must be until interface is deleted + entry->fragmenter_buf = NULL; + } lowpan_list_entry_free(list, entry); } } @@ -388,11 +392,11 @@ int8_t lowpan_adaptation_interface_free(int8_t interface_id) ns_list_remove(&fragmenter_interface_list, interface_ptr); //free active tx process - lowpan_list_free(&interface_ptr->activeUnicastList); + lowpan_list_free(&interface_ptr->activeUnicastList, false); lowpan_active_buffer_state_reset(&interface_ptr->active_broadcast_tx_buf); //Free Indirect entry - lowpan_list_free(&interface_ptr->indirect_tx_queue); + lowpan_list_free(&interface_ptr->indirect_tx_queue, true); buffer_free_list(&interface_ptr->directTxQueue); @@ -413,13 +417,13 @@ int8_t lowpan_adaptation_interface_reset(int8_t interface_id) } //free active tx process - lowpan_list_free(&interface_ptr->activeUnicastList); + lowpan_list_free(&interface_ptr->activeUnicastList, false); lowpan_active_buffer_state_reset(&interface_ptr->active_broadcast_tx_buf); //Clean fragmented message flag interface_ptr->fragmenter_active = false; //Free Indirect entry - lowpan_list_free(&interface_ptr->indirect_tx_queue); + lowpan_list_free(&interface_ptr->indirect_tx_queue, true); buffer_free_list(&interface_ptr->directTxQueue);