Details
Description
For several platforms, there exists an XMLMutex named atomicOpsMutex. This
object is a global with static scope, and should have its constructor executed
on startup. After its constructor has finished, atomicOpsMutex.fHandle should
point to a valid mutex.
XMLPlatformUtils::platformInit() will re-assign atomicOpsMutex.fHandle without
checking if the pointer is non-0, thereby leaking the initial mutex. This
occurs on Linux, FreeBSD, HP-UX, and IRIX.
I made a simple conditional in each offending source file:
if (atomicOpsMutex.fHandle == 0)
{
atomicOpsMutex.fHandle = XMLPlatformUtils::makeMutex();
}