Skip to content

Commit 40abace

Browse files
author
Arto Kinnunen
authored
Update memory allocation and adjust trace (#102)
-Do not use temporary heap for message handler class as the class is never deallocated -Small adjustment to traces
1 parent fc7bec3 commit 40abace

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

source/coap_connection_handler.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,6 @@ static int send_to_real_socket(int8_t socket_id, const ns_address_t *address, co
404404
ns_cmsghdr_t *cmsg;
405405
ns_in6_pktinfo_t *pktinfo;
406406

407-
tr_debug("send from source address %s", trace_array(source_address, 16));
408407
msghdr.msg_control = ancillary_databuffer;
409408
msghdr.msg_controllen = sizeof(ancillary_databuffer);
410409

source/coap_message_handler.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ static int8_t coap_rx_function(sn_coap_hdr_s *resp_ptr, sn_nsdl_addr_s *address_
166166
(void)address_ptr;
167167
(void)param;
168168

169-
tr_warn("transaction was not handled %d", resp_ptr->msg_id);
169+
tr_warn("transaction not handled %d", resp_ptr->msg_id);
170170
if (!resp_ptr) {
171171
return -1;
172172
}
@@ -193,7 +193,7 @@ coap_msg_handler_t *coap_message_handler_init(void *(*used_malloc_func_ptr)(uint
193193
}
194194

195195
coap_msg_handler_t *handle;
196-
handle = used_malloc_func_ptr(sizeof(coap_msg_handler_t));
196+
handle = ns_dyn_mem_alloc(sizeof(coap_msg_handler_t));
197197
if (handle == NULL) {
198198
return NULL;
199199
}
@@ -207,7 +207,7 @@ coap_msg_handler_t *coap_message_handler_init(void *(*used_malloc_func_ptr)(uint
207207

208208
handle->coap = sn_coap_protocol_init(used_malloc_func_ptr, used_free_func_ptr, used_tx_callback_ptr, &coap_rx_function);
209209
if( !handle->coap ){
210-
used_free_func_ptr(handle);
210+
ns_dyn_mem_free(handle);
211211
return NULL;
212212
}
213213

0 commit comments

Comments
 (0)