diff options
author | Nikita Popov <nikic@php.net> | 2012-02-18 14:58:19 +0000 |
---|---|---|
committer | Nikita Popov <nikic@php.net> | 2012-02-18 14:58:19 +0000 |
commit | bfcc199f2867efdf667dbc68a3325cf92d71d3f8 (patch) | |
tree | 9ea10840a3dd8ddc97c82c6039dc10c23d59d2cf /ext/xmlrpc | |
parent | daa190f8fd5441b077bfd5ae8e999596a8c34dd3 (diff) | |
download | php-git-bfcc199f2867efdf667dbc68a3325cf92d71d3f8.tar.gz |
Fix bug #61097 Memory leak in xmlrpc functions copying zvals
Needs to be merged to 5.4.
Diffstat (limited to 'ext/xmlrpc')
-rw-r--r-- | ext/xmlrpc/tests/bug61097.phpt | 16 | ||||
-rw-r--r-- | ext/xmlrpc/xmlrpc-epi-php.c | 10 |
2 files changed, 20 insertions, 6 deletions
diff --git a/ext/xmlrpc/tests/bug61097.phpt b/ext/xmlrpc/tests/bug61097.phpt new file mode 100644 index 0000000000..1b75247225 --- /dev/null +++ b/ext/xmlrpc/tests/bug61097.phpt @@ -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 diff --git a/ext/xmlrpc/xmlrpc-epi-php.c b/ext/xmlrpc/xmlrpc-epi-php.c index 7fb97d21e1..13886c7537 100644 --- a/ext/xmlrpc/xmlrpc-epi-php.c +++ b/ext/xmlrpc/xmlrpc-epi-php.c @@ -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); |