freerots 使用cjson后程序溢出处理方法

新版本修改地方如下

/*修改前*/
#define internal_malloc malloc
#define internal_free free
#define internal_realloc realloc
/*修改后*/
#define internal_malloc pvPortMalloc
#define internal_free vPortFree
#define internal_realloc NULL

老版本中存在以下代码

static void *(*cJSON_malloc)(size_t sz) = malloc;
static void (*cJSON_free)(void *ptr) = free;

直接将malloc与free修改即可

static void *(*cJSON_malloc)(size_t sz) = pvPortMalloc;
static void (*cJSON_free)(void *ptr) = vPortFree;

posted on 2022-12-26 12:41  码农也疯狂  阅读(70)  评论(0编辑  收藏  举报

导航