fix memory leak on thrown exception
remove unnecessary assignment