summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/bz2/bz2.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/bz2/bz2.c b/ext/bz2/bz2.c
index 4718220205..7b5ab44e3a 100644
--- a/ext/bz2/bz2.c
+++ b/ext/bz2/bz2.c
@@ -196,7 +196,7 @@ PHP_BZ2_API php_stream *_php_stream_bz2open(php_stream_wrapper *wrapper,
/* remove the file created by php_stream_open_wrapper(), it is not needed since BZ2 functions
* failed.
*/
- if (!bz_file && mode[0] == 'w') {
+ if (opened_path && !bz_file && mode[0] == 'w') {
VCWD_UNLINK(*opened_path);
}
}