Skip to content

Commit 5620e27

Browse files
nielsdosbukka
andcommitted
Destroy file_handle in fpm_main
If it's not in the CG(open_files) list, we need to destroy the file handle ourselves. Co-authored-by: Jakub Zelenka <[email protected]>
1 parent b09be29 commit 5620e27

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

sapi/fpm/fpm/fpm_main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1918,6 +1918,13 @@ consult the installation file that came with this distribution, or visit \n\
19181918

19191919
php_execute_script(&file_handle);
19201920

1921+
/* Without opcache, or the first time with opcache, the file handle will be placed
1922+
* in the CG(open_files) list by open_file_for_scanning(). Starting from the second
1923+
* request in opcache, the file handle won't be in the list and therefore won't be destroyed for us. */
1924+
if (!file_handle.in_list) {
1925+
zend_destroy_file_handle(&file_handle);
1926+
}
1927+
19211928
fastcgi_request_done:
19221929
if (EXPECTED(primary_script)) {
19231930
efree(primary_script);

0 commit comments

Comments
 (0)