]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Use res_ndestroy on systems that have it. Otherwise, use res_nclose.
authorJason Parker <jparker@digium.com>
Tue, 10 Jul 2007 18:37:23 +0000 (18:37 +0000)
committerJason Parker <jparker@digium.com>
Tue, 10 Jul 2007 18:37:23 +0000 (18:37 +0000)
This prevents a memleak on NetBSD - and possibly others.

Issue 10133, patch by me, reported and tested by scw

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@74373 65c4cc65-6c06-0410-ace0-fbb531ad65f3

dns.c

diff --git a/dns.c b/dns.c
index 8b26ff3779035248a79beb6ebc8a38ddb89fd6aa..d71c76ad7cbdf9ac29a1cc2e7fa06a33901ed654 100644 (file)
--- a/dns.c
+++ b/dns.c
@@ -175,6 +175,9 @@ static int dns_parse_answer(void *context,
 
 #if defined(res_ninit)
 #define HAS_RES_NINIT
+#if defined(res_ndestroy)
+#define HAS_RES_NDESTROY
+#endif
 #else
 AST_MUTEX_DEFINE_STATIC(res_lock);
 #if 0
@@ -217,7 +220,11 @@ int ast_search_dns(void *context,
                        ret = 1;
        }
 #ifdef HAS_RES_NINIT
+#ifdef HAS_RES_NDESTROY
+       res_ndestroy(&dnsstate);
+#else
        res_nclose(&dnsstate);
+#endif
 #else
 #ifndef __APPLE__
        res_close();