Revised memory leaks error