浏览代码

fix: xxtea,应使用luat的内存分配函数

Wendal Chen 5 月之前
父节点
当前提交
430af4a760
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      components/xxtea/src/xxtea2.c

+ 7 - 0
components/xxtea/src/xxtea2.c

@@ -92,6 +92,13 @@ typedef unsigned __int32 uint32_t;
     for (i = 0; (i < 16) && (fixed_key[i] != 0); ++i);\
     for (++i; i < 16; ++i) fixed_key[i] = 0;\
 
+#include "luat_mem.h"
+#undef free
+#undef malloc
+#undef calloc
+#define free luat_heap_free
+#define malloc luat_heap_malloc
+#define calloc luat_heap_calloc
 
 static uint32_t * xxtea_to_uint_array(const uint8_t * data, size_t len, int inc_len, size_t * out_len) {
     uint32_t *out;