ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
ln882x_zero_malloc.c
Go to the documentation of this file.
1/*
2 * LN882x: heap_5 returns NULL for a zero-size request, and the SDK's
3 * malloc-failed hook ends in LN_ASSERT(0), which spins until the watchdog
4 * resets the chip. LibreTiny's scan handler asks for zero entries when a scan
5 * finds no networks. Linked with -Wl,--wrap=pvPortMalloc so every allocation
6 * comes through here; drop it once LibreTiny no longer allocates zero entries.
7 */
8
9#ifdef USE_LN882X
10
11#include <stddef.h>
12
13void *__real_pvPortMalloc(size_t size); // NOLINT(readability-identifier-naming)
14
15void *__wrap_pvPortMalloc(size_t size) { // NOLINT(readability-identifier-naming)
16 return __real_pvPortMalloc(size == 0 ? 1 : size);
17}
18
19#endif // USE_LN882X
void * __real_pvPortMalloc(size_t size)
void * __wrap_pvPortMalloc(size_t size)