xfjx / TonUINO

Die DIY Musikbox (nicht nur) für Kinder
https://www.voss.earth/tonuino/
GNU General Public License v3.0
449 stars 404 forks source link

Possible memory leak in function readCard #43

Open pit-nrw opened 5 years ago

pit-nrw commented 5 years ago

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. https://github.com/xfjx/TonUINO/blob/73b568159303285d43ff8fec8605237cddbbb49a/Tonuino.ino#L1635-L1642

Should be fixed by using: delete activeModifier;

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

AlexanderWillner commented 4 years ago

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