1
0
mirror of https://github.com/php/php-src.git synced 2026-03-27 17:52:16 +01:00

sapi_getenv() estrdups the returned string now, so we need to free it

This commit is contained in:
Rasmus Lerdorf
2006-06-26 13:03:41 +00:00
parent 731c3e4db0
commit eef9835bb1

View File

@@ -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;
}
/* }}} */