RT-Thread-packages / CMSIS

CMSIS(Cortex Microcontroller Software Interface Standard) package on RT-Thread
Apache License 2.0
12 stars 9 forks source link

osThreadNew 函数存在内存泄漏 #16

Open ningzhihui1997 opened 2 years ago

ningzhihui1997 commented 2 years ago

1. if ((RT_NULL == attr) || (RT_NULL == attr->cb_mem)) { thread_cb = rt_malloc(sizeof(thread_cb_t)); if (RT_NULL == thread_cb) return RT_NULL; rt_memset(thread_cb, 0, sizeof(thread_cb_t)); thread_cb->flags |= MALLOC_CB; } 2. if ((RT_NULL == attr) || (osPriorityNone == attr->priority)) { thread_cb->prio = osPriorityNormal; } else { if ((attr->priority < osPriorityIdle) || (attr->priority > osPriorityISR)) return RT_NULL;

    thread_cb->prio = attr->priority;
}

此处 return 未释放上边的thread_cb