2ed20f8768
When a DNS lookup fails, we end up creating a datagram socket but never properly close it. This wastes limited valuable file descriptors and causes CTS test failures. Generally, we should ensure that sockets or files are opened in a try block, and closed in a finally block. Bug: 3276283 Change-Id: I3432f3bc061268c7367948230f6edbdfcec55892