Use proper allocation and destruction for it. Since the allocation is no longer zero-initialized make sure the fields are explicitly zeroed out. This also allows to use an easier way to initialize mutexes. Currently no functional changes, preparing for a bigger refactor.