summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2005-10-25 14:57:14 +0000
committerAntony Dovgal <tony2001@php.net>2005-10-25 14:57:14 +0000
commite4152608688e2e4949419cf9f8a1197a5140dfdb (patch)
tree859f8f86978f1ac862b04ee42151c484d25b8d82
parent4d3c8240d517d9fcba773e33df1fcb4df8ef80a8 (diff)
downloadphp-git-e4152608688e2e4949419cf9f8a1197a5140dfdb.tar.gz
MFH: apply workaround for the leak only when GLIBC is used
-rw-r--r--ext/standard/dns.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/ext/standard/dns.c b/ext/standard/dns.c
index ffe8d0b702..a85c5466cc 100644
--- a/ext/standard/dns.c
+++ b/ext/standard/dns.c
@@ -366,6 +366,9 @@ typedef union {
* res_thread_freeres() in glibc/resolv/res_init.c
* __libc_res_nsend() in resolv/res_send.c
* */
+
+#ifdef __GLIBC__
+#define php_dns_free_res(__res__) _php_dns_free_res(__res__)
static void _php_dns_free_res(struct __res_state res) { /* {{{ */
int ns;
for (ns = 0; ns < MAXNS; ns++) {
@@ -375,6 +378,9 @@ static void _php_dns_free_res(struct __res_state res) { /* {{{ */
}
}
} /* }}} */
+#else
+#define php_dns_free_res(__res__)
+#endif
/* {{{ php_parserr */
static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int store, zval **subarray)
@@ -763,7 +769,7 @@ PHP_FUNCTION(dns_get_record)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "res_nmkquery() failed");
zval_dtor(return_value);
res_nclose(&res);
- _php_dns_free_res(res);
+ php_dns_free_res(res);
RETURN_FALSE;
}
n = res_nsend(&res, buf.qb2, n, answer.qb2, sizeof answer);
@@ -771,7 +777,7 @@ PHP_FUNCTION(dns_get_record)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "res_nsend() failed");
zval_dtor(return_value);
res_nclose(&res);
- _php_dns_free_res(res);
+ php_dns_free_res(res);
RETURN_FALSE;
}
@@ -790,7 +796,7 @@ PHP_FUNCTION(dns_get_record)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to parse DNS data received");
zval_dtor(return_value);
res_nclose(&res);
- _php_dns_free_res(res);
+ php_dns_free_res(res);
RETURN_FALSE;
}
cp += n + QFIXEDSZ;
@@ -806,7 +812,7 @@ PHP_FUNCTION(dns_get_record)
}
}
res_nclose(&res);
- _php_dns_free_res(res);
+ php_dns_free_res(res);
}
}