Fix memory leak with nameserver and domain configuration