nikic                                    Fri, 02 Mar 2012 14:08:11 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=323818

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

Bug: https://bugs.php.net/61097 (Assigned) Memory leak in xmlrpc functions 
copying zvals
      
Changed paths:
    U   php/php-src/branches/PHP_5_4/NEWS
    A   php/php-src/branches/PHP_5_4/ext/xmlrpc/tests/bug61097.phpt
    U   php/php-src/branches/PHP_5_4/ext/xmlrpc/xmlrpc-epi-php.c

Modified: php/php-src/branches/PHP_5_4/NEWS
===================================================================
--- php/php-src/branches/PHP_5_4/NEWS   2012-03-02 13:17:32 UTC (rev 323817)
+++ php/php-src/branches/PHP_5_4/NEWS   2012-03-02 14:08:11 UTC (rev 323818)
@@ -40,6 +40,9 @@
   . 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:

Added: php/php-src/branches/PHP_5_4/ext/xmlrpc/tests/bug61097.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/ext/xmlrpc/tests/bug61097.phpt                 
        (rev 0)
+++ php/php-src/branches/PHP_5_4/ext/xmlrpc/tests/bug61097.phpt 2012-03-02 
14:08:11 UTC (rev 323818)
@@ -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

Modified: php/php-src/branches/PHP_5_4/ext/xmlrpc/xmlrpc-epi-php.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/xmlrpc/xmlrpc-epi-php.c    2012-03-02 
13:17:32 UTC (rev 323817)
+++ php/php-src/branches/PHP_5_4/ext/xmlrpc/xmlrpc-epi-php.c    2012-03-02 
14:08:11 UTC (rev 323818)
@@ -1043,9 +1043,8 @@
                 */
                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 @@

        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);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to