Now maze factory is responsible for freeing the maze object.