From 033fbe68c00e85e70b2669e6972827e28a0a37ce Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Wed, 28 Dec 2016 12:25:17 -0800 Subject: [PATCH] Free after we wait (#148) Dont free the memory while it may still being used. --- src/internal/NeoEsp8266UartMethod.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/internal/NeoEsp8266UartMethod.cpp b/src/internal/NeoEsp8266UartMethod.cpp index d680244..7bfc3e0 100644 --- a/src/internal/NeoEsp8266UartMethod.cpp +++ b/src/internal/NeoEsp8266UartMethod.cpp @@ -63,14 +63,14 @@ NeoEsp8266Uart::NeoEsp8266Uart(uint16_t pixelCount, size_t elementSize) NeoEsp8266Uart::~NeoEsp8266Uart() { - free(_pixels); - // Wait until the TX fifo is empty. This way we avoid broken frames // when destroying & creating a NeoPixelBus to change its length. while (getUartTxFifoLength() > 0) { yield(); } + + free(_pixels); } void NeoEsp8266Uart::InitializeUart(uint32_t uartBaud)