1
0
mirror of https://github.com/php/php-src.git synced 2026-04-28 10:43:30 +02:00

Merge: Fix bug #61097: Memory leak in xmlrpc functions copying zvals

This commit is contained in:
Nikita Popov
2012-03-02 14:08:11 +00:00
parent 503c94fc9a
commit 0dcff95182
3 changed files with 23 additions and 6 deletions
+3
View File
@@ -40,6 +40,9 @@ PHP NEWS
. Fixed bug #61058 (array_fill leaks if start index is PHP_INT_MAX).
(Laruence)
- XMLRPC:
. Fixed bug #61097 (Memory leak in xmlrpc functions copying zvals). (Nikita Popov)
01 Mar 2012, PHP 5.4.0
- Installation:
+16
View File
@@ -0,0 +1,16 @@
--TEST--
Bug #61097 (Memory leak in xmlrpc functions copying zvals)
--SKIPIF--
<?php if (!extension_loaded("xmlrpc")) print "skip"; ?>
--FILE--
<?php
$server = xmlrpc_server_create();
$method = 'abc';
xmlrpc_server_register_introspection_callback($server, $method);
xmlrpc_server_register_method($server, 'abc', $method);
echo 'Done';
?>
--EXPECT--
Done
+4 -6
View File
@@ -1043,9 +1043,8 @@ PHP_FUNCTION(xmlrpc_server_register_method)
*/
if (XMLRPC_ServerRegisterMethod(server->server_ptr, method_key, php_xmlrpc_callback)) {
/* save for later use */
MAKE_STD_ZVAL(method_name_save);
*method_name_save = **method_name;
zval_copy_ctor(method_name_save);
ALLOC_ZVAL(method_name_save);
MAKE_COPY_ZVAL(method_name, method_name_save);
/* register our php method */
add_zval(server->method_map, method_key, &method_name_save);
@@ -1073,9 +1072,8 @@ PHP_FUNCTION(xmlrpc_server_register_introspection_callback)
if (type == le_xmlrpc_server) {
/* save for later use */
MAKE_STD_ZVAL(method_name_save);
*method_name_save = **method_name;
zval_copy_ctor(method_name_save);
ALLOC_ZVAL(method_name_save);
MAKE_COPY_ZVAL(method_name, method_name_save);
/* register our php method */
add_zval(server->introspection_map, NULL, &method_name_save);