Fixed memory leak when using createPalette from FLASH

This commit is contained in:
Alexey Sharov 2023-02-02 23:22:29 +01:00
parent 8c83eb84bd
commit f64a24e0ef
1 changed files with 5 additions and 0 deletions

View File

@ -254,6 +254,11 @@ void TFT_eSprite::createPalette(uint16_t colorMap[], uint8_t colors)
***************************************************************************************/
void TFT_eSprite::createPalette(const uint16_t colorMap[], uint8_t colors)
{
if (_colorMap != nullptr)
{
free(_colorMap);
}
if (colorMap == nullptr)
{
// Create a color map using the default FLASH map