[Memory] Fix leak in typesystem.