Bugfix: deallocate_ip_address in-loop deletion

* Refactored deallocate_ip_address such that list traversal was separate
from deleting elements from the list.
* Updated tests.
Merge pull request #88 from asadoughi/dealloc_ip_fix

Bugfix: deallocate_ip_address in-loop deletion