Fixed memory leak in countdown screen, causing a crash within 2 minutes

This commit is contained in:
Mark van Renswoude 2018-02-14 22:02:38 +01:00
parent ad65d4e233
commit 617fa3fbd2
2 changed files with 3 additions and 2 deletions

View File

@ -119,7 +119,6 @@ const char* FormatPercentage(uint8_t percentage)
{
char* value = new char[6];
itoa(percentage, value, 10);
uint8_t length = strlen(value);

View File

@ -14,7 +14,9 @@ inline uint32_t intDivCeil(uint32_t x, uint32_t y)
void CountdownScreen::printRemainingTime()
{
LCDPrintLineCentered(getDisplay(), 1, FormatTime(mLastDisplayed));
const char* time = FormatTime(mLastDisplayed);
LCDPrintLineCentered(getDisplay(), 1, time);
delete[] time;
}