tony2001                Fri Feb 23 20:51:02 2007 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/ext/curl   interface.c 
  Log:
  MFH: fix leak
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/curl/interface.c?r1=1.62.2.14.2.22&r2=1.62.2.14.2.23&diff_format=u
Index: php-src/ext/curl/interface.c
diff -u php-src/ext/curl/interface.c:1.62.2.14.2.22 
php-src/ext/curl/interface.c:1.62.2.14.2.23
--- php-src/ext/curl/interface.c:1.62.2.14.2.22 Fri Jan 19 18:03:33 2007
+++ php-src/ext/curl/interface.c        Fri Feb 23 20:51:02 2007
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: interface.c,v 1.62.2.14.2.22 2007/01/19 18:03:33 tony2001 Exp $ */
+/* $Id: interface.c,v 1.62.2.14.2.23 2007/02/23 20:51:02 tony2001 Exp $ */
 
 #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
 
@@ -715,7 +715,9 @@
                case PHP_CURL_FILE:
                        return fwrite(data, size, nmemb, t->fp);
                case PHP_CURL_RETURN:
-                       smart_str_appendl(&t->buf, data, (int) length);
+                       if (length > 0) {
+                               smart_str_appendl(&t->buf, data, (int) length);
+                       }
                        break;
                case PHP_CURL_USER: {
                        zval **argv[2];
@@ -854,7 +856,7 @@
                case PHP_CURL_STDOUT:
                        /* Handle special case write when we're returning the 
entire transfer
                         */
-                       if (ch->handlers->write->method == PHP_CURL_RETURN) {
+                       if (ch->handlers->write->method == PHP_CURL_RETURN && 
length > 0) {
                                smart_str_appendl(&ch->handlers->write->buf, 
data, (int) length);
                        } else {
                                PHPWRITE(data, length);

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

Reply via email to