Oups, I forgot the cleanup :p

On Mon, Oct 6, 2014 at 9:45 PM, Yann Ylavic <ylavic....@gmail.com> wrote:
> Index: server/mpm/prefork/prefork.c
> ===================================================================
> --- server/mpm/prefork/prefork.c    (revision 1629482)
> +++ server/mpm/prefork/prefork.c    (working copy)
[...]
> @@ -1232,6 +1250,16 @@ static int prefork_run(apr_pool_t *_pconf, apr_poo
>          return DONE;
>      }
>
> +    if (!retained->bucket) {
> +        retained->daemons_limit = ap_daemons_limit;
> +        retained->bucket = ap_malloc(sizeof(int) * ap_daemons_limit);
> +        if (!retained->bucket) {
> +            ap_log_error(APLOG_MARK, APLOG_CRIT, 0, ap_server_conf, APLOGNO()
> +                         "could not allocate buckets");
> +        }

Here:
+        apr_pool_cleanup_register(s->process->pool, retained->bucket,
+                                  free_bucket, apr_pool_cleanup_null);

> +    }
> +    memcpy(retained->bucket, bucket, sizeof(int) * ap_daemons_limit);
> +
>      /* advance to the next generation */
>      /* XXX: we really need to make sure this new generation number isn't in
>       * use by any of the children.
> [END]

With :

static apr_status_t free_bucket(void *bucket)
{
    free(bucket);
    return APR_SUCCESS;
}

Reply via email to