Merged revisions 127663 via svnmerge from
[asterisk/asterisk.git] / main / dns.c
index 34212fd..4884406 100644 (file)
@@ -263,6 +263,7 @@ int ast_search_dns(void *context,
        int res, ret = -1;
 
 #ifdef HAVE_RES_NINIT
+       memset(&dnsstate, 0, sizeof(dnsstate));
        res_ninit(&dnsstate);
        res = res_nsearch(&dnsstate, dname, class, type, answer, sizeof(answer));
 #else
@@ -274,12 +275,10 @@ int ast_search_dns(void *context,
                if ((res = dns_parse_answer(context, class, type, answer, res, callback)) < 0) {
                        ast_log(LOG_WARNING, "DNS Parse error for %s\n", dname);
                        ret = -1;
-               }
-               else if (res == 0) {
+               } else if (res == 0) {
                        ast_debug(1, "No matches found in DNS for %s\n", dname);
                        ret = 0;
-               }
-               else
+               } else
                        ret = 1;
        }
 #ifdef HAVE_RES_NINIT