[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/ext/curl/interface.c trunk/ext/curl/interface.c
pierrick Mon, 21 Nov 2011 02:44:28 + Revision: http://svn.php.net/viewvc?view=revisionrevision=319594 Log: Fix memory leak Changed paths: U php/php-src/branches/PHP_5_4/ext/curl/interface.c U php/php-src/trunk/ext/curl/interface.c Modified: php/php-src/branches/PHP_5_4/ext/curl/interface.c === --- php/php-src/branches/PHP_5_4/ext/curl/interface.c 2011-11-21 02:29:24 UTC (rev 319593) +++ php/php-src/branches/PHP_5_4/ext/curl/interface.c 2011-11-21 02:44:28 UTC (rev 319594) @@ -2035,6 +2035,7 @@ char *string_key = NULL; uint string_key_len; ulong num_key; + int numeric_key; SEPARATE_ZVAL(current); convert_to_string_ex(current); @@ -2045,6 +2046,9 @@ if(!string_key) { spprintf(string_key, 0, %ld, num_key); string_key_len = strlen(string_key)+1; + numeric_key = 1; + } else { + numeric_key = 0; } postval = Z_STRVAL_PP(current); @@ -2088,6 +2092,10 @@ CURLFORM_CONTENTSLENGTH, (long)Z_STRLEN_PP(current), CURLFORM_END); } + + if (numeric_key) { + efree(string_key); + } } SAVE_CURL_ERROR(ch, error); Modified: php/php-src/trunk/ext/curl/interface.c === --- php/php-src/trunk/ext/curl/interface.c 2011-11-21 02:29:24 UTC (rev 319593) +++ php/php-src/trunk/ext/curl/interface.c 2011-11-21 02:44:28 UTC (rev 319594) @@ -2035,6 +2035,7 @@ char *string_key = NULL; uint string_key_len; ulong num_key; + intnumeric_key; SEPARATE_ZVAL(current); convert_to_string_ex(current); @@ -2045,6 +2046,9 @@ if(!string_key) { spprintf(string_key, 0, %ld, num_key); string_key_len = strlen(string_key)+1; + numeric_key = 1; + } else { + numeric_key = 0; } postval = Z_STRVAL_PP(current); @@ -2088,6 +2092,10 @@ CURLFORM_CONTENTSLENGTH, (long)Z_STRLEN_PP(current), CURLFORM_END); } + + if (numeric_key) { + efree(string_key); + } } SAVE_CURL_ERROR(ch, error); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/ext/curl/interface.c trunk/ext/curl/interface.c
rasmus Fri, 23 Sep 2011 13:16:37 + Revision: http://svn.php.net/viewvc?view=revisionrevision=317201 Log: Fix for bug #55767 Bug: https://bugs.php.net/55767 (Open) CURLOPT_POSTFIELDS Ignores Numeric Field Names Changed paths: U php/php-src/branches/PHP_5_4/ext/curl/interface.c U php/php-src/trunk/ext/curl/interface.c Modified: php/php-src/branches/PHP_5_4/ext/curl/interface.c === --- php/php-src/branches/PHP_5_4/ext/curl/interface.c 2011-09-23 13:12:28 UTC (rev 317200) +++ php/php-src/branches/PHP_5_4/ext/curl/interface.c 2011-09-23 13:16:37 UTC (rev 317201) @@ -2028,6 +2028,11 @@ convert_to_string_ex(current); zend_hash_get_current_key_ex(postfields, string_key, string_key_len, num_key, 0, NULL); + /* Pretend we have a string_key here */ + if(!string_key) { + spprintf(string_key, 0, %ld, num_key); + string_key_len = strlen(string_key)+1; + } postval = Z_STRVAL_PP(current); Modified: php/php-src/trunk/ext/curl/interface.c === --- php/php-src/trunk/ext/curl/interface.c 2011-09-23 13:12:28 UTC (rev 317200) +++ php/php-src/trunk/ext/curl/interface.c 2011-09-23 13:16:37 UTC (rev 317201) @@ -2029,6 +2029,12 @@ zend_hash_get_current_key_ex(postfields, string_key, string_key_len, num_key, 0, NULL); + /* Pretend we have a string_key here */ + if(!string_key) { + spprintf(string_key, 0, %ld, num_key); + string_key_len = strlen(string_key)+1; + } + postval = Z_STRVAL_PP(current); /* The arguments after _NAMELENGTH and _CONTENTSLENGTH -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/ext/curl/interface.c trunk/ext/curl/interface.c
Hello, any regression tests to be added? 2011/9/23 Rasmus Lerdorf ras...@php.net: rasmus Fri, 23 Sep 2011 13:16:37 + Revision: http://svn.php.net/viewvc?view=revisionrevision=317201 Log: Fix for bug #55767 Bug: https://bugs.php.net/55767 (Open) CURLOPT_POSTFIELDS Ignores Numeric Field Names Changed paths: U php/php-src/branches/PHP_5_4/ext/curl/interface.c U php/php-src/trunk/ext/curl/interface.c Modified: php/php-src/branches/PHP_5_4/ext/curl/interface.c === --- php/php-src/branches/PHP_5_4/ext/curl/interface.c 2011-09-23 13:12:28 UTC (rev 317200) +++ php/php-src/branches/PHP_5_4/ext/curl/interface.c 2011-09-23 13:16:37 UTC (rev 317201) @@ -2028,6 +2028,11 @@ convert_to_string_ex(current); zend_hash_get_current_key_ex(postfields, string_key, string_key_len, num_key, 0, NULL); + /* Pretend we have a string_key here */ + if(!string_key) { + spprintf(string_key, 0, %ld, num_key); + string_key_len = strlen(string_key)+1; + } postval = Z_STRVAL_PP(current); Modified: php/php-src/trunk/ext/curl/interface.c === --- php/php-src/trunk/ext/curl/interface.c 2011-09-23 13:12:28 UTC (rev 317200) +++ php/php-src/trunk/ext/curl/interface.c 2011-09-23 13:16:37 UTC (rev 317201) @@ -2029,6 +2029,12 @@ zend_hash_get_current_key_ex(postfields, string_key, string_key_len, num_key, 0, NULL); + /* Pretend we have a string_key here */ + if(!string_key) { + spprintf(string_key, 0, %ld, num_key); + string_key_len = strlen(string_key)+1; + } + postval = Z_STRVAL_PP(current); /* The arguments after _NAMELENGTH and _CONTENTSLENGTH -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Regards, Shein Alexey