summaryrefslogtreecommitdiff
path: root/main/streams/plain_wrapper.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2007-02-13 23:39:14 +0000
committerIlia Alshanetsky <iliaa@php.net>2007-02-13 23:39:14 +0000
commita92ef5e0dc792f96ac2a1659fdd7f695d2884f04 (patch)
treeef35a8a571e90c98b9e5dacef4d26c746f071a63 /main/streams/plain_wrapper.c
parent32c2c7a510c809f3cf81c960b33f13fff0a630be (diff)
downloadphp-git-a92ef5e0dc792f96ac2a1659fdd7f695d2884f04.tar.gz
Fixed a memory leak on highlight_file() with a non-existant file
Diffstat (limited to 'main/streams/plain_wrapper.c')
-rw-r--r--main/streams/plain_wrapper.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c
index ab7d67ceb0..430f789732 100644
--- a/main/streams/plain_wrapper.c
+++ b/main/streams/plain_wrapper.c
@@ -889,12 +889,12 @@ PHPAPI php_stream *_php_stream_fopen(const char *filename, const char *mode, cha
*opened_path = realpath;
realpath = NULL;
}
- if (realpath) {
- efree(realpath);
- }
/* fall through */
case PHP_STREAM_PERSISTENT_FAILURE:
+ if (realpath) {
+ efree(realpath);
+ }
efree(persistent_id);;
return ret;
}
@@ -933,6 +933,10 @@ PHPAPI php_stream *_php_stream_fopen(const char *filename, const char *mode, cha
r = do_fstat(self, 0);
if ((r == 0 && !S_ISREG(self->sb.st_mode))) {
+ if (opened_path) {
+ efree(*opened_path);
+ *opened_path = NULL;
+ }
php_stream_close(ret);
return NULL;
}