[PHP-CVS] com php-src: fix memory leak: ext/spl/spl_dllist.c
Commit:d99c14b1a64ffe18fd6ed45e956ace020fcd8440 Author:Xinchen Hui larue...@php.net Thu, 21 Mar 2013 10:56:30 +0800 Parents: 45b1d014f262a7881095b8f413e8ee43de6e8e6f Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d99c14b1a64ffe18fd6ed45e956ace020fcd8440 Log: fix memory leak the value shouldn't be ref, use z_add_ref is enough Changed paths: M ext/spl/spl_dllist.c Diff: diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c index 8361086..aa462df 100644 --- a/ext/spl/spl_dllist.c +++ b/ext/spl/spl_dllist.c @@ -1246,7 +1246,6 @@ SPL_METHOD(SplDoublyLinkedList, add) if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, zz, zindex, value) == FAILURE) { return; } - SEPARATE_ARG_IF_REF(value); intern = (spl_dllist_object*)zend_object_store_get_object(getThis() TSRMLS_CC); index = spl_offset_convert_to_long(zindex TSRMLS_CC); @@ -1256,6 +1255,7 @@ SPL_METHOD(SplDoublyLinkedList, add) return; } + Z_ADDREF_P(value); if (index == intern-llist-count) { /* If index is the last entry+1 then we do a push because we're not inserting before any entry */ spl_ptr_llist_push(intern-llist, value TSRMLS_CC); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: fix memory leak: ext/spl/spl_dllist.c
Commit:da6916a770b7be6e029579a1d34302b5d2112ece Author:Xinchen Hui larue...@php.net Thu, 21 Mar 2013 10:56:30 +0800 Parents: 6f17c6242fcc1c26ba987f185662b8dd815fd7dc Branches: PHP-5.5 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=da6916a770b7be6e029579a1d34302b5d2112ece Log: fix memory leak the value shouldn't be ref, use z_add_ref is enough Changed paths: M ext/spl/spl_dllist.c Diff: diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c index 8361086..aa462df 100644 --- a/ext/spl/spl_dllist.c +++ b/ext/spl/spl_dllist.c @@ -1246,7 +1246,6 @@ SPL_METHOD(SplDoublyLinkedList, add) if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, zz, zindex, value) == FAILURE) { return; } - SEPARATE_ARG_IF_REF(value); intern = (spl_dllist_object*)zend_object_store_get_object(getThis() TSRMLS_CC); index = spl_offset_convert_to_long(zindex TSRMLS_CC); @@ -1256,6 +1255,7 @@ SPL_METHOD(SplDoublyLinkedList, add) return; } + Z_ADDREF_P(value); if (index == intern-llist-count) { /* If index is the last entry+1 then we do a push because we're not inserting before any entry */ spl_ptr_llist_push(intern-llist, value TSRMLS_CC); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php