mirror of
https://github.com/php/php-src.git
synced 2024-11-24 10:24:11 +08:00
Fix bug #61097 Memory leak in xmlrpc functions copying zvals
Needs to be merged to 5.4.
This commit is contained in:
parent
daa190f8fd
commit
bfcc199f28
3
NEWS
3
NEWS
@ -54,6 +54,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). (Nikic)
|
||||
|
||||
02 Feb 2012, PHP 5.3.10
|
||||
|
||||
- Core:
|
||||
|
16
ext/xmlrpc/tests/bug61097.phpt
Normal file
16
ext/xmlrpc/tests/bug61097.phpt
Normal 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
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user