mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-08-17 05:51:35 +02:00
The NETOS implementation of wolfSSL_JoinThread released the buffer that tx_thread_create had been given as the thread's execution stack without first waiting for the thread to complete, and never unregistered the thread from ThreadX. A join issued while the callback was still running handed the running thread's stack back to the allocator. Waiting was not possible with the previous THREAD_TYPE layout, because it embedded the TX_THREAD control block by value and wolfSSL_JoinThread takes THREAD_TYPE by value, so the join only ever saw a stale copy of the control block. Store a pointer to a heap allocated TX_THREAD instead, the way the Zephyr port already does, so the join operates on the block ThreadX is scheduling. wolfSSL_JoinThread now polls tx_thread_info_get until the thread reports TX_COMPLETED or TX_TERMINATED, calls tx_thread_delete and checks its result, and only then frees the stack and the control block. Fixes F-7413.