Skip to content

Potential memory leak #14

@sreekants

Description

@sreekants

In LoRa_E22.cpp a buffer is allocated in each call

...
ResponseStructContainer LoRa_E22::receiveMessageComplete(const uint8_t size, bool rssiEnabled){
ResponseStructContainer rc;

rc.data = malloc(size);
   ...

However, in all of the samples, you appear not to release the memory, for example esp32_e22_04_SendFixedTransmission.ino:

...
if (e22ttl.available()>1) {
// read the String message
#ifdef ENABLE_RSSI
ResponseContainer rc = e22ttl.receiveMessageRSSI();
#else
ResponseContainer rc = e22ttl.receiveMessage();
#endif
...

Isn't rc.close() required to release the memory? Also, is there a way to avoid malloc() every time you receive a message to avoid fragmentation?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions