Memory leak found and fixed