memory leak on MySQL_Connection.MySQL_Packet.buffer
pabloandresm opened this issue · 1 comments
The packet buffer is allocated with the first message, and reallocated if a bigger message arrives.
So far, so good.
The problem: it is never freed.
So if your MySQL_Connection is a global variable, there is no problem. But if you used MySQL_Connection as a local variable in a function, that buffer is never freed.
The cause for this: there is no class destructor to check for this buffer and free it before the destruction of the object.
The fix? Personally, I would add a destructor in the class MySQL_Packet, that free(buffer);
Workaround for this? before exiting your function (in which MySQL_Connection local variable was created and used) perform this:
if (MySQL_Connection.buffer) free(MySQL_Connection.buffer);
The new MySQL_MariaDB_Generic releases v1.6.0 has just been published. Your contribution is noted in Contributions and Thanks
Please have some more tests to verify the bugs have been squashed and if there is any more bug.
With the contributions from users like you, the library is better and better everyday.
Best Regards,
Release v1.6.0
- Fix memory leak bugs. Check memory leak on 'server_version' #17 and memory leak on MySQL_Connection.MySQL_Packet.buffer #18
- Optimize library code by using
reference-passinginstead ofvalue-passing - Update RP2040 Ethernet-related examples to use the same SS/CS pin GP17 for ArduinoCore-mbed mbed_rp2040 core as arduino-pico rp2040 core
- Update
Packages' Patches