Fix memory leak of view.