diff --git a/source/6LoWPAN/Thread/thread_dhcpv6_client.c b/source/6LoWPAN/Thread/thread_dhcpv6_client.c index 68ae6f43302..2eec89060ef 100644 --- a/source/6LoWPAN/Thread/thread_dhcpv6_client.c +++ b/source/6LoWPAN/Thread/thread_dhcpv6_client.c @@ -284,7 +284,7 @@ void thread_dhcpv6_renew(protocol_interface_info_entry_t *interface, if_address_ payload_len = libdhcpv6_address_request_message_len(srv_data_ptr->clientLinkIdType, srv_data_ptr->serverLinkType, 0); payload_ptr = ns_dyn_mem_temporary_alloc(payload_len); if (payload_ptr == NULL) { - addr->state_timer = 200;//Retry after? should there be maximum 20 second retry + addr->state_timer = 200; //Retry after 20 seconds tr_error("Out of memory"); return ; } @@ -308,6 +308,11 @@ void thread_dhcpv6_renew(protocol_interface_info_entry_t *interface, if_address_ libdhcpv6_generic_nontemporal_address_message_write(payload_ptr, &packetReq, &nonTemporalAddress, &serverLink); // send solicit srv_data_ptr->transActionId = dhcp_service_send_req(dhcp_client.service_instance, 0, srv_data_ptr, srv_data_ptr->server_address, payload_ptr, payload_len, dhcp_solicit_resp_cb); + if (srv_data_ptr->transActionId == 0) { + ns_dyn_mem_free(payload_ptr); + addr->state_timer = 200; //Retry after 20 seconds + tr_error("DHCP renew send failed"); + } } void thread_dhcpv6_client_set_address(int8_t interface_id, dhcpv6_client_server_data_t *srv_data_ptr)