Fix one memory leak and one uninitialized variable