You can use MCAutoPointer class here - MCAutoPointer<char> t_target... Then &t_target to set it (in the return parameter) and *t_target to get the pointer. This removes the need to 'delete' later. I suggest using this in all similary places.