if network is ever NULL, then it would have crashed beforehand.
When this gets called from (device.c) free_network, second argument is NULL