httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ryan Bloom" <...@covalent.net>
Subject RE: the most common seg fault on daedalus
Date Mon, 08 Apr 2002 18:25:22 GMT
> In this function:
> 
> APR_DECLARE(apr_status_t) apr_mmap_dup(apr_mmap_t **new_mmap,
>                                        apr_mmap_t *old_mmap,
>                                        apr_pool_t *p,
>                                        int transfer_ownership)
> {
>     *new_mmap = (apr_mmap_t *)apr_pmemdup(p, old_mmap,
> sizeof(apr_mmap_t));
>     (*new_mmap)->cntxt = p;
> 
>     /* The old_mmap can transfer ownership only if the old_mmap itself
>      * is an owner of the mmap'ed segment.
>      */
>     if (old_mmap->is_owner) {
>         if (transfer_ownership) {
>             (*new_mmap)->is_owner = 1;
>             old_mmap->is_owner = 0;
>             apr_pool_cleanup_kill(old_mmap->cntxt, old_mmap,
> mmap_cleanup);
>         }
>         else {
>             (*new_mmap)->is_owner = 0;
>         }
>         apr_pool_cleanup_register(p, *new_mmap, mmap_cleanup,
>                                   apr_pool_cleanup_null);
>     }
>     return APR_SUCCESS;
> }
> 
> 
> Why is apr_pool_cleanup_register() called regardless of whether we're
> transferring ownership or not?  Shouldn't it only be called if
> (transfer_ownership), same as the apr_pool_cleanup_kill() call?

Yes.  That looks like a bug.

Ryan


Mime
View raw message