Skip to content

Commit

Permalink
this should be done together with deleting pthread structure
Browse files Browse the repository at this point in the history
  • Loading branch information
f-hoepfinger-hr-agrartechnik committed Feb 3, 2023
1 parent 1ac4672 commit 857d61b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions components/pthread/pthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ static esp_pthread_t *pthread_find(TaskHandle_t task_handle)
static void pthread_delete(esp_pthread_t *pthread)
{
SLIST_REMOVE(&s_threads_list, pthread, esp_pthread_entry, list_node);
free(pthread->task_arg);
if (pthread->task_arg) {
free(pthread->task_arg);
}
free(pthread->stack_for_task);
free(pthread->taskTC);
free(pthread);
Expand Down Expand Up @@ -450,9 +452,6 @@ void pthread_exit(void *value_ptr)
if (!pthread) {
assert(false && "Failed to find pthread for current task!");
}
if (pthread->task_arg) {
free(pthread->task_arg);
}
if (pthread->detached) {
// auto-free for detached threads
pthread_delete(pthread);
Expand Down

0 comments on commit 857d61b

Please sign in to comment.