From: Rui Hirokawa Date: Sun, 10 Jun 2001 09:41:43 +0000 (+0000) Subject: modified code freeing resouce which causes segmentation fault. X-Git-Tag: PRE_GRANULAR_GARBAGE_FIX~95 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fd46c91466ad8bd41f300a5afa68c422cac4e290;p=php modified code freeing resouce which causes segmentation fault. --- 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)) {