This repository has been archived by the owner on Jan 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
memory leak on 'server_version' #17
Comments
khoih-prog
added a commit
that referenced
this issue
Mar 11, 2022
### Release v1.6.0 1. Fix memory leak bugs. Check [memory leak on 'server_version' #17](#17) and [memory leak on MySQL_Connection.MySQL_Packet.buffer #18](#18) 2. Optimize library code by using `reference-passing` instead of `value-passing` 3. Update RP2040 Ethernet-related examples to use SS/CS pin GP17 for ARDUINO_ARCH_MBED similar to arduino-pico core 4. Update `Packages' Patches`
khoih-prog
added a commit
that referenced
this issue
Mar 11, 2022
### Release v1.6.0 1. Fix memory leak bugs. Check [memory leak on 'server_version' #17](#17) and [memory leak on MySQL_Connection.MySQL_Packet.buffer #18](#18) 2. Optimize library code by using `reference-passing` instead of `value-passing` 3. Update RP2040 Ethernet-related examples to use SS/CS pin GP17 for ARDUINO_ARCH_MBED similar to arduino-pico core 4. Update `Packages' Patches`
khoih-prog
added a commit
that referenced
this issue
Mar 11, 2022
### Release v1.6.0 1. Fix memory leak bugs. Check [memory leak on 'server_version' #17](#17) and [memory leak on MySQL_Connection.MySQL_Packet.buffer #18](#18) 2. Optimize library code by using `reference-passing` instead of `value-passing` 3. Update RP2040 Ethernet-related examples to use SS/CS pin GP17 for ARDUINO_ARCH_MBED similar to arduino-pico core 4. Update `Packages' Patches`
khoih-prog
added a commit
that referenced
this issue
Mar 11, 2022
### Release v1.6.0 1. Fix memory leak bugs. Check [memory leak on 'server_version' #17](#17) and [memory leak on MySQL_Connection.MySQL_Packet.buffer #18](#18) 2. Optimize library code by using `reference-passing` instead of `value-passing` 3. Update RP2040 Ethernet-related examples to use the same SS/CS pin GP17 for [ArduinoCore-mbed mbed_rp2040 core](https://github.com/arduino/ArduinoCore-mbed) as [arduino-pico rp2040 core](https://github.com/earlephilhower/arduino-pico) 4. Update `Packages' Patches`
khoih-prog
added a commit
that referenced
this issue
Mar 11, 2022
### Release v1.6.0 1. Fix memory leak bugs. Check [memory leak on 'server_version' #17](#17) and [memory leak on MySQL_Connection.MySQL_Packet.buffer #18](#18) 2. Optimize library code by using `reference-passing` instead of `value-passing` 3. Update RP2040 Ethernet-related examples to use the same SS/CS pin GP17 for [ArduinoCore-mbed mbed_rp2040 core](https://github.com/arduino/ArduinoCore-mbed) as [arduino-pico rp2040 core](https://github.com/earlephilhower/arduino-pico) 4. Update `Packages' Patches`
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
|
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
If you use .connect() with the correct database server, but wrong user credentials, the .connect() does "server_version=malloc()" when it calls parse_handshake_packet(), but as the user is wrong, it exits, without calling the "free(server_version)".
This free(server_version) is only called at the end of the .connect().
So the bug is when the .connect() exists after parse_handshake_packet(), missing the correspondent free(server_version) at all possible exits.
A workaround for this is:
MySQL_Connection->server_version=NULL;
bool res = MySQL_Connection->connect(...);
if (res==false)
if (MySQL_Connection->server_version)
free(MySQL_Connection->server_version);
To reproduce is easy. Perform a .connect() in a loop, pointing to a correct mariadb, but with unknown user/password.
In that loop show ESP.getFreeHeap(), and you will see the memory leak.
The text was updated successfully, but these errors were encountered: