Closed Azmatron closed 3 years ago
As a further note. I tried reverting back to ESP-IDF 4.2 with the same result
Thank you for the detailed report. Hopefully it should be an easy one to reproduce on my end. I’ll check this weekend.
Hi thank you for the quick response (and sharing this really cool app). I think that I have found the issue.
In the wifi_manager_event_handler function at the WIFI_EVENT_STA_DISCONNECTED case, the code is allocating memory for the disconnected param but it is using the variable rather than type to determine size.
wifi_event_sta_disconnected_t*
wifi_event_sta_disconnected = (wifi_event_sta_disconnected_t*)malloc(sizeof(wifi_event_sta_disconnected));`
I believe rather it should be
wifi_event_sta_disconnected_t*
wifi_event_sta_disconnected = (wifi_event_sta_disconnected_t*)malloc(sizeof(wifi_event_sta_disconnected_t));`
I have added this change locally and it seems to now be behaving correctly with no heap corruption.
Please let me know your thoughts
Yeah that's a big oops. I have checked the code and the rest of the params are ok.
eg
wifi_event_sta_scan_done_t* event_sta_scan_done = (wifi_event_sta_scan_done_t*)malloc(sizeof(wifi_event_sta_scan_done_t));
and
ip_event_got_ip_t* ip_event_got_ip = (ip_event_got_ip_t*)malloc(sizeof(ip_event_got_ip_t));
Prerequisites
Description
Using esp32-wifi-manager, it works flawlessly until the ESP32 cannot connect to the wireless router. As soon as the wifi connection is not seen the ESP crashes. It seems to be some form of heap corruption and occurs when the disconnect message is added to the queue. I have tried on multiple devices and multiple applications, including stripped down application and even the examples app provided. All have the same behavior.
Is this reproducible or am I doing something stupid?
Below are logs from running the "default_demo" example
Steps to Reproduce
System Configuration
Building on Windows 10 Latest esp-idf (ESP-IDF v4.3-dev-907) Lastest esp32-wifi-manager