Fix memory leak in Format class.