From a82ec4499f02585ae093ba676ee92ba25b2093cf Mon Sep 17 00:00:00 2001 From: Erik Ekman Date: Thu, 3 Nov 2016 12:13:05 +0100 Subject: [PATCH] memp: Check for null in memp_free When memp_free_pool was split out from memp_free (c838e1ed5b8c42648de2), the check for freeing the null pointer was lost. This resulted in the null value being put back in the list of free objects, causing all subsequent allocations of that type to fail. --- src/core/memp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/memp.c b/src/core/memp.c index 19198eb7..ad8e8fd6 100644 --- a/src/core/memp.c +++ b/src/core/memp.c @@ -471,6 +471,10 @@ memp_free(memp_t type, void *mem) LWIP_ERROR("memp_free: type < MEMP_MAX", (type < MEMP_MAX), return;); + if (mem == NULL) { + return; + } + #if MEMP_OVERFLOW_CHECK >= 2 memp_overflow_check_all(); #endif /* MEMP_OVERFLOW_CHECK >= 2 */