-
Notifications
You must be signed in to change notification settings - Fork 964
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
[Bug]: Memory leaks in MQTT::onReceive #5549
Comments
Great analysis! Would you be willing to submit a PR making the proposed changes? |
The above has been resolved. I'll send a PR. |
Same as here -> #5458 |
Thank you @esev for the contribution, I'm already testing your changes on my device. |
I will test as soon as this pull is available in the coming alpha. |
Category
Other
Hardware
Not Applicable
Firmware Version
2.5.16.f81d3b0
Description
I believe there are two potential memory leaks in
src/mqtt/MQTT.cpp
MQTT::onReceive
firmware/src/mqtt/MQTT.cpp
Line 148 in 761a99d
meshtastic_ServiceEnvelope
that are non-NULL are leaked.firmware/src/mqtt/MQTT.cpp
Line 202 in 761a99d
meshtastic_MeshPacket *p
is leaked when theif
statement evaluates tofalse
There are several places in MQTT::onReceive where calls to free/release are needed. If I may offer a suggestion; use std::unique_ptr to help ensure these are always freed/released on
return
Example:
Relevant log output
No response
The text was updated successfully, but these errors were encountered: