diff --git a/components/pthread/pthread.c b/components/pthread/pthread.c index 7be44b2b9b..1d64cddcc3 100644 --- a/components/pthread/pthread.c +++ b/components/pthread/pthread.c @@ -593,6 +593,14 @@ int pthread_mutex_destroy(pthread_mutex_t *mutex) return EBUSY; } + if (mux->type == PTHREAD_MUTEX_RECURSIVE) { + res = xSemaphoreGiveRecursive(mux->sem); + } else { + res = xSemaphoreGive(mux->sem); + } + if (res != pdTRUE) { + assert(false && "Failed to release mutex!"); + } vSemaphoreDelete(mux->sem); free(mux);