summaryrefslogtreecommitdiff
path: root/ext/spl/spl_directory.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-03-18 11:04:25 +0100
committerNikita Popov <nikita.ppv@gmail.com>2019-03-18 11:06:23 +0100
commit4f034016289f5a52073bfd012899dd3e202742b5 (patch)
treee83f199daf50427aa25d079dd832cf0c5754643f /ext/spl/spl_directory.c
parent54bf8c820f4ac2c9204cd09b66fbe99c3db5939b (diff)
downloadphp-git-4f034016289f5a52073bfd012899dd3e202742b5.tar.gz
Partial fix for bug #77751
This avoids the segfault, but it will not make writing to the SplFileObject during output shutdown work.
Diffstat (limited to 'ext/spl/spl_directory.c')
-rw-r--r--ext/spl/spl_directory.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index f13a48a5ad..47b3521d63 100644
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -97,6 +97,7 @@ static void spl_filesystem_object_destroy_object(zend_object *object) /* {{{ */
} else {
php_stream_pclose(intern->u.file.stream);
}
+ intern->u.file.stream = NULL;
}
break;
}
@@ -127,13 +128,11 @@ static void spl_filesystem_object_free_storage(zend_object *object) /* {{{ */
}
break;
case SPL_FS_FILE:
- if (intern->u.file.stream) {
- if (intern->u.file.open_mode) {
- efree(intern->u.file.open_mode);
- }
- if (intern->orig_path) {
- efree(intern->orig_path);
- }
+ if (intern->u.file.open_mode) {
+ efree(intern->u.file.open_mode);
+ }
+ if (intern->orig_path) {
+ efree(intern->orig_path);
}
spl_filesystem_file_free_line(intern);
break;