-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Memory leak on multiple calls to loadCACert and others on WiFiClientSecure #5826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This temporary fix worked for me. https://github.com/espressif/arduino-esp32/compare/master...sguarin:fix_streamLoad?expand=1 |
Just a repeat of the comment I placed with that commit: You're not checking the return value of And no need to check if |
You are right. Thanks! |
If you have a system that can accept certs configuration, then multiple calls to loadCACert or related functions will not reutilize the memory assigned.
https://github.com/sguarin/arduino-esp32/blob/caa8d07aafa04441bb85e6046a795249c01d9e39/libraries/WiFiClientSecure/src/WiFiClientSecure.cpp#L304
_streamLoad()
allocates memory for new certificates. A better approach should be using realloc().
https://github.com/sguarin/arduino-esp32/blob/caa8d07aafa04441bb85e6046a795249c01d9e39/libraries/WiFiClientSecure/src/WiFiClientSecure.cpp#L290
The text was updated successfully, but these errors were encountered: