apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Stoddard <b...@wstoddard.com>
Subject Re: huge memory leak in 2.0.x
Date Tue, 15 Jun 2004 21:25:18 GMT

> @@ -1340,7 +1343,7 @@
>  
>      /* Run cleanups */
>      run_cleanups(&pool->cleanups);
> -    pool->cleanups = NULL;
> +    pool->free_cleanups = pool->cleanups = NULL;
>  
>      /* If new child pools showed up, this is a reason to raise a flag */
>      if (pool->child)
> @@ -1886,7 +1889,13 @@
>  #endif /* APR_POOL_DEBUG */
>  
>      if (p != NULL) {
> -        c = (cleanup_t *)apr_palloc(p, sizeof(cleanup_t));
> +        if (p->free_cleanups) {
> +            /* reuse a cleanup structure */
> +            c = p->free_cleanups;
> +            p->free_cleanups = c->next;
> +        } else {
> +            c = (cleanup_t *)apr_palloc(p, sizeof(cleanup_t));
> +        }
>          c->data = data;
>          c->plain_cleanup_fn = plain_cleanup_fn;
>          c->child_cleanup_fn = child_cleanup_fn;

            c->next = NULL; ????


Mime
View raw message