On 03.12.2007 18:19, Rachmel, Nir (Nir) wrote:
> Hi,
> 
> I have been doing some code-reading. Why is the RSHUTDOWN function for
> syslog ext called only when run under win32?
> Shouldn't the cleanup happen on linux as well?

`man closelog` says it's not required.

DESCRIPTION
       closelog() closes the descriptor being used to write to the system 
logger.  The use of closelog() is optional.

> Another question is for the use of zend_strndup instead of one of the
> non-persistent memory allocation functions (i.e. estrndup() ) ?
> There is no use for this variable after the request dies (as far as I
> understand).

Right, if you use estrndup(), the memory is freed at the end of request,
while zend_strndup() bypasses Zend memory manager using malloc() directly.
 
> However, so far, I can't seem to understand who/what corrupts my memory.

Me neither :/

> What do you think about extending the RINIT function instead of:
> PHP_RINIT_FUNCTION(syslog)
> {
>       if (INI_INT("define_syslog_variables")) {
>               start_syslog(TSRMLS_C);
>       } else {
>               BG(syslog_started)=0;
>               BG(syslog_device)=NULL; /* This is the addition */

I think this would just create a memleak.
BG(syslog_device) is checked for NULL and freed in openlog() and MSHUTDOWN.

-- 
Wbr, 
Antony Dovgal

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to