Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

platform:fix possible double free for FreeRTOS #98

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion mqttclient/mqttclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,6 @@ static void mqtt_yield_thread(void *arg)
if(NULL != thread_to_be_destoried)
{
platform_thread_destroy(thread_to_be_destoried);
platform_memory_free(thread_to_be_destoried);
thread_to_be_destoried = NULL;
}
}
Expand Down
1 change: 1 addition & 0 deletions platform/RT-Thread/platform_thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ void platform_thread_start(platform_thread_t* thread)

void platform_thread_destroy(platform_thread_t* thread)
{
rt_thread_delete(thread->thread);
platform_memory_free(thread);
}

Expand Down
2 changes: 1 addition & 1 deletion platform/TencentOS-tiny/platform_thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ void platform_thread_destroy(platform_thread_t* thread)
{
if (NULL != thread)
tos_task_destroy(&(thread->thread));
platform_memory_free(thread->thread.stk_base);
platform_memory_free(&(thread->thread));
platform_memory_free(&(thread->thread.stk_size));
}


4 changes: 3 additions & 1 deletion platform/linux/platform_thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ void platform_thread_start(platform_thread_t* thread)

void platform_thread_destroy(platform_thread_t* thread)
{
if (NULL != thread)
if (NULL != thread) {
pthread_detach(thread->thread);
platform_memory_free(thread);
}
}