com php-src: Return empty string: ext/standard/file.c
| From: | Dmitry Stogov | Date: | Mon, 03 Mar 2014 15:09:31 +0000 |
| Subject: | com php-src: Return empty string: ext/standard/file.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-77793@lists.php.net to get a copy of this message | ||
Commit: d821c9014887ae8fa5ad032ec3c04df7efafa55b
Author: Xinchen Hui <laruence@gmail.com> Mon, 3 Mar 2014 23:09:31 +0800
Parents: 1f228e46d04bc7dde854c0be5beee7fa28da2e5f
Branches: phpng
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d821c9014887ae8fa5ad032ec3c04df7efafa55b
Log:
Return empty string
Changed paths:
M ext/standard/file.c
Diff:
diff --git a/ext/standard/file.c b/ext/standard/file.c
index ffe9b00..0367056 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -556,7 +556,7 @@ PHP_FUNCTION(file_get_contents)
if ((contents = php_stream_copy_to_mem(stream, maxlen, 0)) != NULL) {
RETVAL_STR(contents);
} else {
- RETVAL_FALSE;
+ RETVAL_STR(STR_EMPTY_ALLOC());
}
php_stream_close(stream);
@@ -825,6 +825,9 @@ PHP_FUNCTION(tempnam)
close(fd);
//??? RETVAL_STRING(opened_path, 0);
RETVAL_STRING(opened_path);
+ //??? temporary fixed the memory leak, I've tried to make opened_path a zend_string
+ //but too too many places need to be changed.... let's keep it simple for now
+ efree(opened_path);
}
STR_RELEASE(p);
}