File tree 1 file changed +4
-5
lines changed
1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -773,9 +773,6 @@ dhcp_set_struct(struct netif *netif, struct dhcp *dhcp)
773
773
* @ingroup dhcp4
774
774
* Removes a struct dhcp from a netif.
775
775
*
776
- * ATTENTION: Only use this when not using dhcp_set_struct() to allocate the
777
- * struct dhcp since the memory is passed back to the heap.
778
- *
779
776
* @param netif the netif from which to remove the struct dhcp
780
777
*/
781
778
void dhcp_cleanup (struct netif * netif )
@@ -811,6 +808,7 @@ dhcp_start(struct netif *netif)
811
808
{
812
809
struct dhcp * dhcp ;
813
810
err_t result ;
811
+ u8_t saved_flags ;
814
812
815
813
LWIP_ASSERT_CORE_LOCKED ();
816
814
LWIP_ERROR ("netif != NULL" , (netif != NULL ), return ERR_ARG ;);
@@ -846,9 +844,10 @@ dhcp_start(struct netif *netif)
846
844
/* dhcp is cleared below, no need to reset flag*/
847
845
}
848
846
849
- /* clear data structure */
847
+ /* clear data structure but preserve DHCP_FLAG_EXTERNAL_MEM for dhcp_cleanup() */
848
+ saved_flags = dhcp -> flags ;
850
849
memset (dhcp , 0 , sizeof (struct dhcp ));
851
- /* dhcp_set_state(&dhcp, DHCP_STATE_OFF); */
850
+ dhcp -> flags = saved_flags & DHCP_FLAG_EXTERNAL_MEM ;
852
851
853
852
854
853
#if LWIP_DHCP_DOES_ACD_CHECK
You can’t perform that action at this time.
0 commit comments