From 3327ffaa155b646d1ce04755388d1e0f8a522caa Mon Sep 17 00:00:00 2001 From: zhouji <956133287@qq.com> Date: Sun, 12 Dec 2021 11:16:26 +0800 Subject: [PATCH] =?UTF-8?q?[update]=20=E4=BD=BF=E7=94=A8memheap=E5=86=85?= =?UTF-8?q?=E5=AD=98=E7=AE=A1=E7=90=86=E6=97=B6=EF=BC=8Crt=5Fmalloc=200?= =?UTF-8?q?=E9=95=BF=E5=BA=A6=E8=BF=94=E5=9B=9ERT=5FNULL,=20=E4=B8=8Eslab?= =?UTF-8?q?=E4=B8=8E=E5=B0=8F=E5=86=85=E5=AD=98=E7=AE=A1=E7=90=86=E7=AD=89?= =?UTF-8?q?=E7=AE=97=E6=B3=95=E4=BF=9D=E6=8C=81=E4=B8=80=E8=87=B4=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/memheap.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/memheap.c b/src/memheap.c index 68a15d1a8e..9c3f570f29 100644 --- a/src/memheap.c +++ b/src/memheap.c @@ -850,6 +850,10 @@ void *rt_malloc(rt_size_t size) { void *ptr; + /* zero size, return RT_NULL */ + if (size == 0) + return RT_NULL; + /* try to allocate in system heap */ ptr = rt_memheap_alloc(&_heap, size); #ifdef RT_USING_MEMHEAP_AUTO_BINDING -- GitLab