summaryrefslogtreecommitdiff
path: root/ext/xsl/php_xsl.c
diff options
context:
space:
mode:
authorRob Richards <rrichards@php.net>2003-07-05 23:43:10 +0000
committerRob Richards <rrichards@php.net>2003-07-05 23:43:10 +0000
commit1688895f6b68bd7c4930004bd0efb54f6dee6308 (patch)
tree666526f6d474d0c9d88e4020bcc3f4928fb50730 /ext/xsl/php_xsl.c
parentf145b163a8281298872a73856238bc5ed0a14713 (diff)
downloadphp-git-1688895f6b68bd7c4930004bd0efb54f6dee6308.tar.gz
use common doc with ref counting rather than copy
Diffstat (limited to 'ext/xsl/php_xsl.c')
-rw-r--r--ext/xsl/php_xsl.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/ext/xsl/php_xsl.c b/ext/xsl/php_xsl.c
index 30db612f94..3b18a7946a 100644
--- a/ext/xsl/php_xsl.c
+++ b/ext/xsl/php_xsl.c
@@ -91,8 +91,15 @@ void xsl_objects_dtor(void *object, zend_object_handle handle TSRMLS_DC)
if (((xsltStylesheetPtr) intern->ptr)->_private != NULL) {
((xsltStylesheetPtr) intern->ptr)->_private = NULL;
}
- /* libxslt uses _private for itself, so turning of the deregistering is maybe a solution
- we copied the doc at import, so it shouldn't be possible to be used from php land */
+ if (intern->document != NULL) {
+ if (--intern->document->refcount == 0) {
+ xmlFreeDoc((xmlDocPtr) intern->document->ptr);
+ efree(intern->document);
+ }
+ ((xsltStylesheetPtr) intern->ptr)->doc = NULL;
+ intern->document = NULL;
+ }
+
xsltFreeStylesheet((xsltStylesheetPtr) intern->ptr);
intern->ptr = NULL;
}