Fix stats_display_memp() to avoid accessing NULLs

It's possible for pool pointers to be NULL.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
This commit is contained in:
Shawn Silverman
2023-08-22 14:44:50 -07:00
committed by Simon Goldschmidt
parent 13d7ac3363
commit 5d32779c1b

View File

@@ -116,8 +116,12 @@ void
stats_display_memp(struct stats_mem *mem, int idx) stats_display_memp(struct stats_mem *mem, int idx)
{ {
if (idx < MEMP_MAX) { if (idx < MEMP_MAX) {
if (mem == NULL) {
LWIP_PLATFORM_DIAG(("\nMEMP[%d]: NULL\n", idx));
} else {
stats_display_mem(mem, mem->name); stats_display_mem(mem, mem->name);
} }
}
} }
#endif /* MEMP_STATS */ #endif /* MEMP_STATS */
#endif /* MEM_STATS || MEMP_STATS */ #endif /* MEM_STATS || MEMP_STATS */