From: Ilia Alshanetsky Date: Fri, 3 Jan 2003 17:12:35 +0000 (+0000) Subject: Fixed a memory leak that occurs if the location specified by redirect header X-Git-Tag: PHP_5_0_dev_before_13561_fix~484 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=71ab7dfccca65d28fd946cb6988b8e52d48461b8;p=php Fixed a memory leak that occurs if the location specified by redirect header cannot be opened. --- diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c index c3f10fd3e9..4ae41fb93c 100644 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@ -311,9 +311,9 @@ php_stream *php_stream_url_wrap_http(php_stream_wrapper *wrapper, char *path, ch php_stream_notify_file_size(context, file_size, http_header_line, 0); } - if (http_header_line[0] == '\0') + if (http_header_line[0] == '\0') { body = 1; - else { + } else { zval *http_header; MAKE_STD_ZVAL(http_header); @@ -322,9 +322,9 @@ php_stream *php_stream_url_wrap_http(php_stream_wrapper *wrapper, char *path, ch zend_hash_next_index_insert(Z_ARRVAL_P(response_header), &http_header, sizeof(zval *), NULL); } - } - else + } else { break; + } } } @@ -379,9 +379,11 @@ php_stream *php_stream_url_wrap_http(php_stream_wrapper *wrapper, char *path, ch } zval_dtor(stream->wrapperdata); FREE_ZVAL(stream->wrapperdata); + } else { + zval_dtor(response_header); + FREE_ZVAL(response_header); } } else { - zval_dtor(response_header); FREE_ZVAL(response_header);