fixing some memory leaks

* audio_reactive.h: catch memory errors from WiFiUDP
* udp: explicitly flush unused receive buffers.
* wled.cpp: additional debug info about "largest available block"
* FX_fcn.cpp: free _globalLeds before running purgeSegments().
This commit is contained in:
Frank
2023-06-07 17:10:32 +02:00
parent 309e66bf8a
commit af6091b493
4 changed files with 30 additions and 13 deletions

View File

@@ -1494,9 +1494,9 @@ void WS2812FX::finalizeInit(void)
//initialize leds array. TBD: realloc if nr of leds change
if (Segment::_globalLeds) {
purgeSegments(true);
free(Segment::_globalLeds);
Segment::_globalLeds = nullptr;
purgeSegments(true); // WLEDMM moved here, because it seems to improve stability.
}
if (useLedsArray && getLengthTotal()>0) { // WLEDMM avoid malloc(0)
size_t arrSize = sizeof(CRGB) * getLengthTotal();