SuperHouse / esp-open-rtos

Open source FreeRTOS-based ESP8266 software framework
BSD 3-Clause "New" or "Revised" License
1.52k stars 491 forks source link

dhcp server memory leak #589

Closed danielcampillo closed 6 years ago

danielcampillo commented 6 years ago

Hi guys There is a memory leak in the function dhcpserver_stop() Before freeing the server_state_t * state pointer, the netconn and leases pointers should be deallocated.

    vTaskDelete(dhcpserver_task_handle);
    netconn_delete(state->nc);/****ADD THIS LINE****/
    free(state->leases);/****ADD THIS LINE****/
    free(state);
    dhcpserver_task_handle = NULL; 

I saw this issue when I was connected to the STATION AP mode of the ESP, then configured it in station mode and then took it back again to the STATION AP mode. After this, I was not able anymore to connect to it from my phone, I had the mesage: station: ec:d0:9f:03:c7:b6 join, AID = 1, but never got an IP addr. To do so I had to restart the chip which is not what I wanted.