Imagine I've got a pthread mutex somewhere on the heap.
pthread_mutex_t *mutex;
Should I always destroy like this before freeing the memory?
pthread_mutex_destroy(mutex);
free(mutex);
Or should I simply invoke free()
without concerning myself with the destroy? From its man page it looks like it switches the mutex internal state back to uninitialized, so is it really necessary when I'm going to free the memory anyway?