diff --git a/src/wp-admin/link-parse-opml.php b/src/wp-admin/link-parse-opml.php index 7a2ad3a1b8..c573db6f60 100644 --- a/src/wp-admin/link-parse-opml.php +++ b/src/wp-admin/link-parse-opml.php @@ -94,3 +94,4 @@ if ( ! xml_parse( $xml_parser, $opml, true ) ) { // Free up memory used by the XML parser. xml_parser_free( $xml_parser ); +unset( $xml_parser ); diff --git a/src/wp-includes/IXR/class-IXR-message.php b/src/wp-includes/IXR/class-IXR-message.php index 6b8cd5a0fa..6c1279e69c 100644 --- a/src/wp-includes/IXR/class-IXR-message.php +++ b/src/wp-includes/IXR/class-IXR-message.php @@ -110,20 +110,28 @@ class IXR_Message $chunk_size = apply_filters( 'xmlrpc_chunk_parsing_size', $chunk_size ); $final = false; + do { if (strlen($this->message) <= $chunk_size) { $final = true; } + $part = substr($this->message, 0, $chunk_size); $this->message = substr($this->message, $chunk_size); + if (!xml_parse($this->_parser, $part, $final)) { + xml_parser_free($this->_parser); + unset($this->_parser); return false; } + if ($final) { break; } } while (true); + xml_parser_free($this->_parser); + unset($this->_parser); // Grab the error messages, if any if ($this->messageType == 'fault') { diff --git a/src/wp-includes/atomlib.php b/src/wp-includes/atomlib.php index 2e8709870e..ce62b13599 100644 --- a/src/wp-includes/atomlib.php +++ b/src/wp-includes/atomlib.php @@ -182,6 +182,7 @@ class AtomParser { fclose($fp); xml_parser_free($parser); + unset($parser); restore_error_handler(); diff --git a/src/wp-includes/feed.php b/src/wp-includes/feed.php index 3e9cf29051..d2fd25ecb0 100644 --- a/src/wp-includes/feed.php +++ b/src/wp-includes/feed.php @@ -564,6 +564,7 @@ function prep_atom_text_construct( $data ) { xml_parse( $parser, '
' . $data . '
', true ); $code = xml_get_error_code( $parser ); xml_parser_free( $parser ); + unset( $parser ); if ( ! $code ) { if ( strpos( $data, '<' ) === false ) { diff --git a/src/wp-includes/rss.php b/src/wp-includes/rss.php index ffc2494789..e61dac5554 100644 --- a/src/wp-includes/rss.php +++ b/src/wp-includes/rss.php @@ -94,6 +94,7 @@ class MagpieRSS { } xml_parser_free( $this->parser ); + unset( $this->parser ); $this->normalize(); }