Fix memory leak if status !=0.