Skip to content

Possible memory leak in function readCard #43

@pit-nrw

Description

@pit-nrw

In function readCard is a possible memory leak, caused by removing of a modifier card.
When a modifier card is removed, only the activeModifier is set to null, but the memory is not freed.

TonUINO/Tonuino.ino

Lines 1635 to 1642 in 73b5681

if (tempCard.nfcFolderSettings.folder == 0) {
if (activeModifier != NULL) {
if (activeModifier->getActive() == tempCard.nfcFolderSettings.mode) {
activeModifier = NULL;
Serial.println(F("modifier removed"));
if (isPlaying()) {
mp3.playAdvertisement(261);
}

Should be fixed by using:
delete activeModifier;

Or the implementation of Modifier class could be changed to contain a destructor which gets called.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions