Explorar el Código

update: free内存的时候额外检查一下是不是NULL, 是NULL就不用释放, 让内存检测器闭嘴

Wendal Chen hace 3 años
padre
commit
9e1b11d674
Se han modificado 1 ficheros con 2 adiciones y 0 borrados
  1. 2 0
      app/port/luat_malloc_air101.c

+ 2 - 0
app/port/luat_malloc_air101.c

@@ -27,6 +27,8 @@ void* luat_heap_malloc(size_t len) {
 }
 
 void luat_heap_free(void* ptr) {
+    if (ptr == NULL)
+        return;
     tls_mem_free(ptr);
 }