Corrected memory leak issue