FIXED: Issue was with the recursion not the pointers. When it returned back through each recursion it would reset the returned VAR to the old maintree. Fixed by making a global VAR and set it before return then made whole function return void. No memory leaks.FIXED: Issue was with the recursion not the poi