dns: Fix segfault with mixed ipv4/ipv6 nameservers

Follow-up on bug #1154432.
Merge pull request #14 from msekletar/rhbz-969707

dns: Fix segfault with mixed ipv4/ipv6 nameservers -- msekletar.