dosomething deletes the allocated memory therefor making the pointer point to NULL, after that you delete it again which will result into a problem im afraid.

edit: doing stuff after dosomething will also result in problems since its no longer there.