Correct memory handling.