rrichards Thu Sep 18 11:46:54 2008 UTC
Modified files:
/php-src/ext/xsl xsltprocessor.c php_xsl.c
Log:
fix bug #46099 (Xsltprocessor::setProfiling - memory leak)
http://cvs.php.net/viewvc.cgi/php-src/ext/xsl/xsltprocessor.c?r1=1.65&r2=1.66&diff_format=u
Index: php-src/ext/xsl/xsltprocessor.c
diff -u php-src/ext/xsl/xsltprocessor.c:1.65
php-src/ext/xsl/xsltprocessor.c:1.66
--- php-src/ext/xsl/xsltprocessor.c:1.65 Sun Aug 3 12:12:45 2008
+++ php-src/ext/xsl/xsltprocessor.c Thu Sep 18 11:46:54 2008
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: xsltprocessor.c,v 1.65 2008/08/03 12:12:45 jani Exp $ */
+/* $Id: xsltprocessor.c,v 1.66 2008/09/18 11:46:54 rrichards Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -555,10 +555,6 @@
php_libxml_decrement_doc_ref(intern->doc TSRMLS_CC);
efree(intern->doc);
intern->doc = NULL;
-
- if (intern->profiling) {
- efree(intern->profiling);
- }
if (params) {
clone = 0;
@@ -882,13 +878,20 @@
{
zval *id;
xsl_object *intern;
- char *filename;
+ char *filename = NULL;
int filename_len;
DOM_GET_THIS(id);
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS()
TSRMLS_CC, "s", &filename, &filename_len) == SUCCESS) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS()
TSRMLS_CC, "s!", &filename, &filename_len) == SUCCESS) {
intern = (xsl_object *)zend_object_store_get_object(id
TSRMLS_CC);
- intern->profiling = estrndup(filename,filename_len);
+ if (intern->profiling) {
+ efree(intern->profiling);
+ }
+ if (filename != NULL) {
+ intern->profiling = estrndup(filename,filename_len);
+ } else {
+ intern->profiling = NULL;
+ }
RETURN_TRUE;
} else {
WRONG_PARAM_COUNT;
http://cvs.php.net/viewvc.cgi/php-src/ext/xsl/php_xsl.c?r1=1.45&r2=1.46&diff_format=u
Index: php-src/ext/xsl/php_xsl.c
diff -u php-src/ext/xsl/php_xsl.c:1.45 php-src/ext/xsl/php_xsl.c:1.46
--- php-src/ext/xsl/php_xsl.c:1.45 Mon Dec 31 07:12:17 2007
+++ php-src/ext/xsl/php_xsl.c Thu Sep 18 11:46:54 2008
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_xsl.c,v 1.45 2007/12/31 07:12:17 sebastian Exp $ */
+/* $Id: php_xsl.c,v 1.46 2008/09/18 11:46:54 rrichards Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -103,6 +103,9 @@
xsltFreeStylesheet((xsltStylesheetPtr) intern->ptr);
intern->ptr = NULL;
}
+ if (intern->profiling) {
+ efree(intern->profiling);
+ }
efree(object);
}
/* }}} */
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php