From d62c3da349d4e255d1f81b2f28db938027a1b73a Mon Sep 17 00:00:00 2001
From: yinbin <yinbin8@huawei.com>
Date: Tue, 20 Aug 2024 19:05:43 +0800
Subject: [PATCH] check if mem_init returns errno

---
 src/core/init.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/core/init.c b/src/core/init.c
index dbe89d7..e6cd9b6 100644
--- a/src/core/init.c
+++ b/src/core/init.c
@@ -357,9 +357,14 @@ lwip_init(void)
   sys_init();
 #endif /* !NO_SYS */
   mem_init();
+#if GAZELLE_ENABLE
+  /* mem_init() will set failed errno. */
+  if (errno != 0)
+    return;
+#endif /* GAZELLE_ENABLE */  
   memp_init();
 #if GAZELLE_ENABLE
-  /* mem_init() and memp_init() will set failed errno. */
+  /* memp_init() will set failed errno. */
   if (errno != 0)
     return;
 #endif /* GAZELLE_ENABLE */
-- 
2.34.1

