From 5d32779c1b70b604c1adde63bc7b1cf739090a24 Mon Sep 17 00:00:00 2001 From: Shawn Silverman Date: Tue, 22 Aug 2023 14:44:50 -0700 Subject: [PATCH] Fix stats_display_memp() to avoid accessing NULLs It's possible for pool pointers to be NULL. Signed-off-by: Simon Goldschmidt --- src/core/stats.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/stats.c b/src/core/stats.c index 95445ec9..e3ba898f 100644 --- a/src/core/stats.c +++ b/src/core/stats.c @@ -116,7 +116,11 @@ void stats_display_memp(struct stats_mem *mem, int idx) { if (idx < MEMP_MAX) { - stats_display_mem(mem, mem->name); + if (mem == NULL) { + LWIP_PLATFORM_DIAG(("\nMEMP[%d]: NULL\n", idx)); + } else { + stats_display_mem(mem, mem->name); + } } } #endif /* MEMP_STATS */