correct memory leak
teacher correction