Fix memleak on some OSes in case network initialization fails. See