mirror of
https://github.com/php/php-src.git
synced 2025-01-10 21:14:37 +08:00
sapi_getenv() estrdups the returned string now, so we need to free it
This commit is contained in:
parent
731c3e4db0
commit
eef9835bb1
@ -4308,13 +4308,14 @@ PHP_FUNCTION(getenv)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
ptr = sapi_getenv(str, str_len TSRMLS_CC);
|
||||
if (! ptr) {
|
||||
if(ptr) {
|
||||
RETVAL_RT_STRING(ptr,1);
|
||||
efree(ptr);
|
||||
} else {
|
||||
ptr = getenv(str);
|
||||
if(ptr) RETURN_RT_STRING(ptr, 1);
|
||||
else RETURN_FALSE;
|
||||
}
|
||||
if (ptr) {
|
||||
RETURN_RT_STRING(ptr, 1);
|
||||
}
|
||||
RETURN_FALSE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user