Removed uninitialized variable; fixed memory leak