]> granicus.if.org Git - php/commitdiff
Fixed a memory leak that occurs if the location specified by redirect header
authorIlia Alshanetsky <iliaa@php.net>
Fri, 3 Jan 2003 17:12:35 +0000 (17:12 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Fri, 3 Jan 2003 17:12:35 +0000 (17:12 +0000)
cannot be opened.

ext/standard/http_fopen_wrapper.c

index c3f10fd3e980c1b86dbffec2ba5ed803945a8440..4ae41fb93c76d399af436f103f6ab63882ca0040 100644 (file)
@@ -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);