diff options
| author | Jani Taskinen <jani@php.net> | 2009-07-25 13:00:25 +0000 |
|---|---|---|
| committer | Jani Taskinen <jani@php.net> | 2009-07-25 13:00:25 +0000 |
| commit | 1941fb2bf10adde43a49d929447589b4b6b4feab (patch) | |
| tree | cd5f728f17c1e959fc661c00c3ddaa8c8e5d96e3 | |
| parent | fb3b83b85a95481e3ce21fd2e623121778620384 (diff) | |
| download | php-git-1941fb2bf10adde43a49d929447589b4b6b4feab.tar.gz | |
- Fixed bug #49052 (context option headers freed too early when using --with-curlwrappers)
| -rw-r--r-- | NEWS | 2 | ||||
| -rw-r--r-- | ext/curl/streams.c | 16 |
2 files changed, 14 insertions, 4 deletions
@@ -4,6 +4,8 @@ PHP NEWS - Fixed regression in cURL extension that prevented flush of data to output defined as a file handle. (Ilia) +- Fixed bug #49052 (context option headers freed too early when using + --with-curlwrappers). (Jani) - Fixed bug #49032 (SplFileObject::fscanf() variables passed by reference). (Jani) - Fixed bug #48980 (Crash when compiling with pdo_firebird). (Felipe) diff --git a/ext/curl/streams.c b/ext/curl/streams.c index e56a3aec31..22ea72b0f3 100644 --- a/ext/curl/streams.c +++ b/ext/curl/streams.c @@ -469,8 +469,7 @@ php_stream *php_curl_stream_opener(php_stream_wrapper *wrapper, char *filename, #else php_error_docref(NULL TSRMLS_CC, E_WARNING, "There was an error mcode=%d", m); #endif - php_stream_close(stream); - return NULL; + goto exit_fail; } /* we have only one curl handle here, even though we use multi syntax, @@ -488,14 +487,23 @@ php_stream *php_curl_stream_opener(php_stream_wrapper *wrapper, char *filename, } } if (msg_found) { - php_stream_close(stream); - return NULL; + goto exit_fail; } } + + /* context headers are not needed anymore */ if (slist) { + curl_easy_setopt(curlstream->curl, CURLOPT_HTTPHEADER, NULL); curl_slist_free_all(slist); } return stream; + +exit_fail: + php_stream_close(stream); + if (slist) { + curl_slist_free_all(slist); + } + return NULL; } static php_stream_wrapper_ops php_curl_wrapper_ops = { |
