Change mutex and semaphore mocks to xmalloc().