com php-src: Implement github PR #1736: ext/standard/config.m4 ext/standard/php_dns.h
| From: | Anatol Belski | Date: | Sat, 07 Jan 2017 14:36:14 +0000 |
| Subject: | com php-src: Implement github PR #1736: ext/standard/config.m4 ext/standard/php_dns.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-96604@lists.php.net to get a copy of this message | ||
Commit: 486fc0424ab1664831ea098546e14dbf2809c637
Author: Anatol Belski <ab@php.net> Sat, 7 Jan 2017 15:36:14 +0100
Parents: 80a5ae4f5389e66fe4bd71b54c7fb8fca06d831b
Branches: PHP-7.0 PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=486fc0424ab1664831ea098546e14dbf2809c637
Log:
Implement github PR #1736
This fixes leak issues on *BSD systems, as described in the PR.
Bugs:
https://bugs.php.net/1736
Changed paths:
M ext/standard/config.m4
M ext/standard/php_dns.h
Diff:
diff --git a/ext/standard/config.m4 b/ext/standard/config.m4
index f9afff3..102cbe5 100644
--- a/ext/standard/config.m4
+++ b/ext/standard/config.m4
@@ -401,6 +401,7 @@ dnl Detect library functions needed by php dns_xxx functions
dnl ext/standard/php_dns.h will collect these in a single define: HAVE_FULL_DNS_FUNCS
dnl
PHP_CHECK_FUNC(res_nsearch, resolv, bind, socket)
+PHP_CHECK_FUNC(res_ndestroy, resolv, bind, socket)
PHP_CHECK_FUNC(dns_search, resolv, bind, socket)
PHP_CHECK_FUNC(dn_expand, resolv, bind, socket)
PHP_CHECK_FUNC(dn_skipname, resolv, bind, socket)
diff --git a/ext/standard/php_dns.h b/ext/standard/php_dns.h
index 8e6931d..6f80d5d 100644
--- a/ext/standard/php_dns.h
+++ b/ext/standard/php_dns.h
@@ -32,9 +32,15 @@
#elif defined(HAVE_RES_NSEARCH)
#define php_dns_search(res, dname, class, type, answer, anslen) \
res_nsearch(res, dname, class, type, answer, anslen);
+#if HAVE_RES_NDESTROY
+#define php_dns_free_handle(res) \
+ res_ndestroy(res); \
+ php_dns_free_res(res)
+#else
#define php_dns_free_handle(res) \
res_nclose(res); \
php_dns_free_res(res)
+#endif
#elif defined(HAVE_RES_SEARCH)
#define php_dns_search(res, dname, class, type, answer, anslen) \