tony2001                Fri Feb 23 20:50:17 2007 UTC

  Modified files:              
    /php-src/ext/curl   interface.c 
  Log:
  fix leak
  no need to allocate the buffer if there was no data
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/curl/interface.c?r1=1.109&r2=1.110&diff_format=u
Index: php-src/ext/curl/interface.c
diff -u php-src/ext/curl/interface.c:1.109 php-src/ext/curl/interface.c:1.110
--- php-src/ext/curl/interface.c:1.109  Fri Jan 19 18:03:25 2007
+++ php-src/ext/curl/interface.c        Fri Feb 23 20:50:17 2007
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: interface.c,v 1.109 2007/01/19 18:03:25 tony2001 Exp $ */
+/* $Id: interface.c,v 1.110 2007/02/23 20:50:17 tony2001 Exp $ */
 
 #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
 
@@ -713,7 +713,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];
@@ -852,7 +854,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