cvs: php4 /ext/xml xml.c

From: Date: Sat, 13 Apr 2002 05:06:35 +0000
Subject: cvs: php4 /ext/xml xml.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-11109@lists.php.net to get a copy of this message
mfischer Sat Apr 13 01:06:35 2002 EDT Modified files: /php4/ext/xml xml.c Log: - Fix a possible memory leak in xml_set_handler(). I stumbled over this while trying out 'pear package' which, while doing xml parsing, re-assigns the variaous callback handlers depending on the version during xml processing. If this check causes problems, let me know. Index: php4/ext/xml/xml.c diff -u php4/ext/xml/xml.c:1.106 php4/ext/xml/xml.c:1.107 --- php4/ext/xml/xml.c:1.106 Tue Apr 9 13:32:39 2002 +++ php4/ext/xml/xml.c Sat Apr 13 01:06:33 2002 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: xml.c,v 1.106 2002/04/09 17:32:39 ssb Exp $ */ +/* $Id: xml.c,v 1.107 2002/04/13 05:06:33 mfischer Exp $ */ #define IS_EXT_MODULE @@ -352,6 +352,11 @@ /* IS_ARRAY might indicate that we're using array($obj, 'method') syntax */ if (Z_TYPE_PP(data) != IS_ARRAY) { convert_to_string_ex(data); + } + + /* If we have already a handler, release it */ + if (*handler) { + zval_ptr_dtor(handler); } zval_add_ref(data);

« previous php.cvs (#11109) next »