]> granicus.if.org Git - php/commitdiff
Better leak fix for cgi -s / -w
authorNikita Popov <nikita.ppv@gmail.com>
Fri, 26 Jun 2020 09:07:55 +0000 (11:07 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Fri, 26 Jun 2020 09:07:55 +0000 (11:07 +0200)
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.

sapi/cgi/cgi_main.c

index 9a64e0f903d5a3c03c061656bc0dd88fd3780f9a..7c9e1bdfa6d1c5764f709ecb782be89ba0a0d46c 100644 (file)
@@ -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;
                        }