HW4:task1: fixed memory leak