rrichards Thu Sep 18 11:47:59 2008 UTC
Modified files: (Branch: PHP_5_3)
/php-src/ext/xsl xsltprocessor.c php_xsl.c
Log:
MFH: fix bug #46099 (Xsltprocessor::setProfiling - memory leak)
http://cvs.php.net/viewvc.cgi/php-src/ext/xsl/xsltprocessor.c?r1=1.39.2.2.2.9.2.8&r2=1.39.2.2.2.9.2.9&diff_format=u
Index: php-src/ext/xsl/xsltprocessor.c
diff -u php-src/ext/xsl/xsltprocessor.c:1.39.2.2.2.9.2.8
php-src/ext/xsl/xsltprocessor.c:1.39.2.2.2.9.2.9
--- php-src/ext/xsl/xsltprocessor.c:1.39.2.2.2.9.2.8 Sun May 4 15:14:23 2008
+++ php-src/ext/xsl/xsltprocessor.c Thu Sep 18 11:47:59 2008
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: xsltprocessor.c,v 1.39.2.2.2.9.2.8 2008/05/04 15:14:23 rrichards Exp $
*/
+/* $Id: xsltprocessor.c,v 1.39.2.2.2.9.2.9 2008/09/18 11:47:59 rrichards Exp $
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -554,10 +554,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;
@@ -849,13 +845,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.32.2.6.2.2.2.4&r2=1.32.2.6.2.2.2.5&diff_format=u
Index: php-src/ext/xsl/php_xsl.c
diff -u php-src/ext/xsl/php_xsl.c:1.32.2.6.2.2.2.4
php-src/ext/xsl/php_xsl.c:1.32.2.6.2.2.2.5
--- php-src/ext/xsl/php_xsl.c:1.32.2.6.2.2.2.4 Mon Dec 31 07:17:16 2007
+++ php-src/ext/xsl/php_xsl.c Thu Sep 18 11:47:59 2008
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_xsl.c,v 1.32.2.6.2.2.2.4 2007/12/31 07:17:16 sebastian Exp $ */
+/* $Id: php_xsl.c,v 1.32.2.6.2.2.2.5 2008/09/18 11:47:59 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