Skip to content
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

Possible memory leak in function readCard #43

Open
pit-nrw opened this issue Aug 5, 2019 · 1 comment
Open

Possible memory leak in function readCard #43

pit-nrw opened this issue Aug 5, 2019 · 1 comment

Comments

@pit-nrw
Copy link

pit-nrw commented Aug 5, 2019

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.

@AlexanderWillner
Copy link

What about a pull request? I'd merge it into my branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants