apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mladen Turk <mt...@apache.org>
Subject Re: svn commit: r910597 - /apr/apr/trunk/shmem/unix/shm.c
Date Tue, 16 Feb 2010 17:20:24 GMT
On 02/16/2010 06:07 PM, jfclere@apache.org wrote:
> Log:
> Make sure we don't leak file descriptors.
>
>           if (new_m->shmkey == (key_t)-1) {
> +            apr_file_close(file);
>               return errno;
>           }

File will be closed when the pool gets destroyed.
Closing here has little advantages cause the pool
memory will rise over time so you cannot be sure
the provided pool won't get dirty if open fails.

It would be better to create a sub pool for shared
memory which will ensure that both parent pool
doesn't leak memory and that file is always closed.
Repeating apr_file_close across all possible return
failures just make no sense when we have pools.


Regards
-- 
^TM

Mime
View raw message