diff options
Diffstat (limited to 'ext/curl/streams.c')
| -rw-r--r-- | ext/curl/streams.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/ext/curl/streams.c b/ext/curl/streams.c index 14d183d6d..26786ad18 100644 --- a/ext/curl/streams.c +++ b/ext/curl/streams.c @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: streams.c,v 1.14.2.2.2.11.2.6 2009/05/19 18:08:57 kalle Exp $ */ +/* $Id: streams.c 284747 2009-07-25 13:00:25Z jani $ */ /* This file implements cURL based wrappers. * NOTE: If you are implementing your own streams that are intended to @@ -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 = { |
