sterling Fri Mar 12 13:41:21 2004 EDT Modified files: /php-src/ext/curl interface.c Log: avoid a memory leak when a php_curl handle is allocated, but the initialization of a CURL handle fails. http://cvs.php.net/diff.php/php-src/ext/curl/interface.c?r1=1.41&r2=1.42&ty=u Index: php-src/ext/curl/interface.c diff -u php-src/ext/curl/interface.c:1.41 php-src/ext/curl/interface.c:1.42 --- php-src/ext/curl/interface.c:1.41 Fri Mar 12 13:37:55 2004 +++ php-src/ext/curl/interface.c Fri Mar 12 13:41:19 2004 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: interface.c,v 1.41 2004/03/12 18:37:55 sterling Exp $ */ +/* $Id: interface.c,v 1.42 2004/03/12 18:41:19 sterling Exp $ */ #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS @@ -730,20 +730,23 @@ { zval **url; php_curl *ch; + CURL *cp; int argc = ZEND_NUM_ARGS(); if (argc < 0 || argc > 1 || zend_get_parameters_ex(argc, &url) == FAILURE) { WRONG_PARAM_COUNT; } - alloc_curl_handle(&ch); - TSRMLS_SET_CTX(ch->thread_ctx); - - ch->cp = curl_easy_init(); - if (!ch->cp) { + cp = curl_easy_init(); + if (!cp) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not initialize a new cURL handle"); RETURN_FALSE; } + + alloc_curl_handle(&ch); + TSRMLS_SET_CTX(ch->thread_ctx); + + ch->cp = cp; ch->handlers->write->method = PHP_CURL_STDOUT; ch->handlers->write->type = PHP_CURL_ASCII;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php