mirror of
https://github.com/php/php-src.git
synced 2024-12-18 14:30:35 +08:00
Make BG(syslog_device) per request
This is not supposed to be retained across requests. Explicitly free it at the end of a request, and use the per-request allocator.
This commit is contained in:
parent
3b9e822e11
commit
b0d7b126a2
@ -91,7 +91,6 @@ PHP_MINIT_FUNCTION(syslog)
|
||||
/* AIX doesn't have LOG_PERROR */
|
||||
REGISTER_LONG_CONSTANT("LOG_PERROR", LOG_PERROR, CONST_CS | CONST_PERSISTENT); /*log to stderr*/
|
||||
#endif
|
||||
BG(syslog_device)=NULL;
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
@ -108,16 +107,16 @@ PHP_RINIT_FUNCTION(syslog)
|
||||
PHP_RSHUTDOWN_FUNCTION(syslog)
|
||||
{
|
||||
closelog();
|
||||
if (BG(syslog_device)) {
|
||||
efree(BG(syslog_device));
|
||||
BG(syslog_device) = NULL;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
PHP_MSHUTDOWN_FUNCTION(syslog)
|
||||
{
|
||||
if (BG(syslog_device)) {
|
||||
free(BG(syslog_device));
|
||||
BG(syslog_device) = NULL;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@ -147,9 +146,9 @@ PHP_FUNCTION(openlog)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
if (BG(syslog_device)) {
|
||||
free(BG(syslog_device));
|
||||
efree(BG(syslog_device));
|
||||
}
|
||||
BG(syslog_device) = zend_strndup(ident, ident_len);
|
||||
BG(syslog_device) = estrndup(ident, ident_len);
|
||||
if(BG(syslog_device) == NULL) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@ -166,7 +165,7 @@ PHP_FUNCTION(closelog)
|
||||
|
||||
closelog();
|
||||
if (BG(syslog_device)) {
|
||||
free(BG(syslog_device));
|
||||
efree(BG(syslog_device));
|
||||
BG(syslog_device) = NULL;
|
||||
}
|
||||
RETURN_TRUE;
|
||||
|
Loading…
Reference in New Issue
Block a user