Unverified Commit d776ec2f authored by Earle F. Philhower, III's avatar Earle F. Philhower, III Committed by GitHub

Fix memory leak in tone/noTone calls (#125)

Was never deleting the tone object on noTone, so eventually the leaked
objects would fill up heap and cause a crash.

Fixes #121
parent 8ae69a34
......@@ -95,6 +95,7 @@ void noTone(uint8_t pin) {
if (entry != _toneMap.end()) {
pio_sm_set_enabled(entry->second->pio, entry->second->sm, false);
pio_sm_unclaim(entry->second->pio, entry->second->sm);
delete entry->second;
_toneMap.erase(entry);
pinMode(pin, OUTPUT);
digitalWrite(pin, LOW);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment