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.

I thought of adding a regression test, but I wasn't sure how to mock out the ORM appropriately. For now, there is a test in krauq.