From: Jani Taskinen Date: Sat, 25 Jul 2009 13:00:25 +0000 (+0000) Subject: - Fixed bug #49052 (context option headers freed too early when using --with-curlwrap... X-Git-Tag: php-5.4.0alpha1~191^2~2991 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=eae3e69f331d0ab292e69bc8afac2ec7cb0efeb1;p=php - Fixed bug #49052 (context option headers freed too early when using --with-curlwrappers) --- diff --git a/ext/curl/streams.c b/ext/curl/streams.c index 05e00fcc4d..51d540dbe8 100644 --- a/ext/curl/streams.c +++ b/ext/curl/streams.c @@ -474,8 +474,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, @@ -493,14 +492,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 = {