Trying to fix some witness warnings about holding a lock and getting malloc memory with waiting.