From 6a2e3237925e45f5082f8fdd62f1c2306049f5f7 Mon Sep 17 00:00:00 2001 From: goldsimon Date: Thu, 10 May 2007 14:23:38 +0000 Subject: [PATCH] Added some ASSERTs and NULL-pointer checks to sys_timeout/sys_untimeout --- src/core/sys.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/core/sys.c b/src/core/sys.c index 883f72ce..26d754ec 100644 --- a/src/core/sys.c +++ b/src/core/sys.c @@ -195,6 +195,7 @@ sys_timeout(u32_t msecs, sys_timeout_handler h, void *arg) timeout = memp_malloc(MEMP_SYS_TIMEOUT); if (timeout == NULL) { + LWIP_ASSERT("sys_timeout: timeout != NULL", timeout != NULL); return; } timeout->next = NULL; @@ -208,6 +209,8 @@ sys_timeout(u32_t msecs, sys_timeout_handler h, void *arg) (void *)timeout, msecs, (void *)h, (void *)arg)); LWIP_ASSERT("sys_timeout: timeouts != NULL", timeouts != NULL); + if (timeouts == NULL) + return; if (timeouts->next == NULL) { timeouts->next = timeout; @@ -246,6 +249,9 @@ sys_untimeout(sys_timeout_handler h, void *arg) timeouts = sys_arch_timeouts(); + LWIP_ASSERT("sys_untimeout: timeouts != NULL", timeouts != NULL); + if (timeouts == NULL) + return; if (timeouts->next == NULL) return;