Posix: Free the condition variable memory in the correct place

In case of deleting a task from another task, the deletion happens
immediately and the thread is canceled but the memory allocated by
the task condition variable is not freed. This causes the memory
checkers (Valgrind, Address sanitizers, ..) to complain.
This commit is contained in:
Reda Maher 2020-09-28 02:26:22 +02:00 committed by Reda Maher
parent e9a2d2701e
commit 1965a90613

View file

@ -411,6 +411,7 @@ Thread_t *pxThreadToCancel = prvGetThreadFromTask( pxTaskToDelete );
*/ */
pthread_cancel( pxThreadToCancel->pthread ); pthread_cancel( pxThreadToCancel->pthread );
pthread_join( pxThreadToCancel->pthread, NULL ); pthread_join( pxThreadToCancel->pthread, NULL );
event_delete( pxThreadToCancel->ev );
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -450,7 +451,6 @@ BaseType_t uxSavedCriticalNesting;
prvResumeThread( pxThreadToResume ); prvResumeThread( pxThreadToResume );
if ( pxThreadToSuspend->xDying ) if ( pxThreadToSuspend->xDying )
{ {
event_delete(pxThreadToSuspend->ev);
pthread_exit( NULL ); pthread_exit( NULL );
} }
prvSuspendSelf( pxThreadToSuspend ); prvSuspendSelf( pxThreadToSuspend );