xmlInitGlobals() is not thread-safe
If xmlInitGlobals()
is called from two different threads before xmlThrDefMutex
is initialized, a race could occur where a pthread_mutex_t
created by xmlNewMutex()
was leaked, and (worse) one thread might use the wrong (leaked) mutex, thus causing thread safety issues.
The fix is to add proper locking to make sure xmlThrDefMutex
is initialized exactly once.
Edited by David Kilzer