com php-src: Fix memory leak: ext/standard/basic_functions. c
| From: | Anatol Belski | Date: | Mon, 27 Nov 2017 19:24:30 +0000 |
| Subject: | com php-src: Fix memory leak: ext/standard/basic_functions. c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-100392@lists.php.net to get a copy of this message | ||
Commit: 2868ff84df1cd6ec2be1e5d60355fe30d6a98923
Author: Anatol Belski <ab@php.net> Mon, 27 Nov 2017 20:24:30 +0100
Parents: 2b7d283cc5589077d7ecc23cc9b2827759cab5c2
Branches: PHP-7.1 PHP-7.2 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2868ff84df1cd6ec2be1e5d60355fe30d6a98923
Log:
Fix memory leak
Changed paths:
M ext/standard/basic_functions.c
Diff:
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 9c613a6..76d1941 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -4088,11 +4088,13 @@ PHP_FUNCTION(getenv)
size = GetEnvironmentVariableW(keyw, &dummybuf, 0);
if (GetLastError() == ERROR_ENVVAR_NOT_FOUND) {
/* The environment variable doesn't exist. */
+ free(keyw);
RETURN_FALSE;
}
if (size == 0) {
/* env exists, but it is empty */
+ free(keyw);
RETURN_EMPTY_STRING();
}