aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-10 18:37:23 +0000
committerqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-10 18:37:23 +0000
commit0ed5a63fe25e24536e2ff632e928d6a3fe5e6a79 (patch)
treeab50af084a4825e5341fbc21fb146a7d7ea6efad
parentdffd0dd2a18590e6998cdcb5a085481e9fef4645 (diff)
Use res_ndestroy on systems that have it. Otherwise, use res_nclose.
This prevents a memleak on NetBSD - and possibly others. Issue 10133, patch by me, reported and tested by scw git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@74373 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--dns.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/dns.c b/dns.c
index 8b26ff377..d71c76ad7 100644
--- 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();