Don't use epicsMutexMustLock() in msgbufGetFree(). When we're shutting down, the pvtData.msgQueueLock gets destroyed. This makes msgbufGetFree() return NULL if the lock is dead. The epicsMutexMustLock() routine asserts(), which recurses...