From: Nikita Popov Date: Fri, 26 Jun 2020 09:07:55 +0000 (+0200) Subject: Better leak fix for cgi -s / -w X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f89d84d62255d7fb88dc1c21ce663e4c093ec658;p=php Better leak fix for cgi -s / -w We also need to go through request shutdown. The naming is a bit confusing, but it's fine to go through fastcgi_request_done even if not using fastcgi. Whether we loop or not is checked separately. --- diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index 9a64e0f903..7c9e1bdfa6 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -2568,9 +2568,8 @@ parent_loop_end: case PHP_MODE_STRIP: if (open_file_for_scanning(&file_handle) == SUCCESS) { zend_strip(); - zend_file_handle_dtor(&file_handle); } - goto parent_out; + break; case PHP_MODE_HIGHLIGHT: { zend_syntax_highlighter_ini syntax_highlighter_ini; @@ -2578,12 +2577,7 @@ parent_loop_end: if (open_file_for_scanning(&file_handle) == SUCCESS) { php_get_highlight_struct(&syntax_highlighter_ini); zend_highlight(&syntax_highlighter_ini); - if (fastcgi) { - goto fastcgi_request_done; - } - zend_file_handle_dtor(&file_handle); } - goto parent_out; } break; }