Created
September 1, 2019 21:16
-
-
Save jumblies/ed1c370c9587c40157dbe434970368fa to your computer and use it in GitHub Desktop.
Possible memory leak fix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool stopPlaying() { | |
bool stopped = false; | |
if (rtttl) { | |
rtttl->stop(); | |
delete rtttl; | |
rtttl = nullptr; | |
stopped = true; | |
} | |
if (mp3) { | |
mp3->stop(); | |
delete mp3; | |
mp3 = nullptr; | |
stopped = true; | |
} | |
if (buff) { | |
buff->close(); | |
delete buff; | |
buff = nullptr; | |
} | |
if (file) { | |
file->close(); | |
delete file; | |
file = nullptr; | |
} | |
if (stream) { | |
stream->close(); | |
delete stream; | |
stream = nullptr; | |
} | |
return stopped; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment