summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRui Hirokawa <hirokawa@php.net>2001-06-10 09:41:43 +0000
committerRui Hirokawa <hirokawa@php.net>2001-06-10 09:41:43 +0000
commitfd46c91466ad8bd41f300a5afa68c422cac4e290 (patch)
tree68572e99cc3343bb9e8e29b9bc6d88eea52cc074
parent22e506727c2581fef34b9914256067daf19cc7ca (diff)
downloadphp-git-fd46c91466ad8bd41f300a5afa68c422cac4e290.tar.gz
modified code freeing resouce which causes segmentation fault.
-rw-r--r--ext/xslt/php_sablot.h2
-rw-r--r--ext/xslt/sablot.c30
2 files changed, 17 insertions, 15 deletions
diff --git a/ext/xslt/php_sablot.h b/ext/xslt/php_sablot.h
index 1c63c68154..f494fba848 100644
--- a/ext/xslt/php_sablot.h
+++ b/ext/xslt/php_sablot.h
@@ -46,6 +46,8 @@ extern zend_module_entry xslt_module_entry;
#define XSLT_ERRSTR(handle) ((handle)->err->str)
#define XSLT_LOG(handle) ((handle)->err->log)
+#define XSLT_FUNCH_FREE(__var) if (__var) zval_ptr_dtor(&(__var));
+
PHP_MINIT_FUNCTION(xslt);
PHP_MINFO_FUNCTION(xslt);
diff --git a/ext/xslt/sablot.c b/ext/xslt/sablot.c
index 28d8c245e4..1b46eec981 100644
--- a/ext/xslt/sablot.c
+++ b/ext/xslt/sablot.c
@@ -609,23 +609,23 @@ static void free_processor(zend_rsrc_list_entry *rsrc)
}
/* Free Scheme handlers */
- zval_ptr_dtor(&XSLT_SCHEME(handle).get_all);
- zval_ptr_dtor(&XSLT_SCHEME(handle).open);
- zval_ptr_dtor(&XSLT_SCHEME(handle).get);
- zval_ptr_dtor(&XSLT_SCHEME(handle).put);
- zval_ptr_dtor(&XSLT_SCHEME(handle).close);
+ XSLT_FUNCH_FREE(XSLT_SCHEME(handle).get_all);
+ XSLT_FUNCH_FREE(XSLT_SCHEME(handle).open);
+ XSLT_FUNCH_FREE(XSLT_SCHEME(handle).get);
+ XSLT_FUNCH_FREE(XSLT_SCHEME(handle).put);
+ XSLT_FUNCH_FREE(XSLT_SCHEME(handle).close);
/* Free SAX handlers */
- zval_ptr_dtor(&XSLT_SAX(handle).doc_start);
- zval_ptr_dtor(&XSLT_SAX(handle).element_start);
- zval_ptr_dtor(&XSLT_SAX(handle).element_end);
- zval_ptr_dtor(&XSLT_SAX(handle).namespace_start);
- zval_ptr_dtor(&XSLT_SAX(handle).namespace_end);
- zval_ptr_dtor(&XSLT_SAX(handle).comment);
- zval_ptr_dtor(&XSLT_SAX(handle).pi);
- zval_ptr_dtor(&XSLT_SAX(handle).characters);
- zval_ptr_dtor(&XSLT_SAX(handle).doc_end);
+ XSLT_FUNCH_FREE(XSLT_SAX(handle).doc_start);
+ XSLT_FUNCH_FREE(XSLT_SAX(handle).element_start);
+ XSLT_FUNCH_FREE(XSLT_SAX(handle).element_end);
+ XSLT_FUNCH_FREE(XSLT_SAX(handle).namespace_start);
+ XSLT_FUNCH_FREE(XSLT_SAX(handle).namespace_end);
+ XSLT_FUNCH_FREE(XSLT_SAX(handle).comment);
+ XSLT_FUNCH_FREE(XSLT_SAX(handle).pi);
+ XSLT_FUNCH_FREE(XSLT_SAX(handle).characters);
+ XSLT_FUNCH_FREE(XSLT_SAX(handle).doc_end);
/* Free error handler */
- zval_ptr_dtor(&XSLT_ERROR(handle));
+ XSLT_FUNCH_FREE(XSLT_ERROR(handle));
/* Free error message, if any */
if (XSLT_ERRSTR(handle)) {