memory leak at ngx_pool_cleanup_add ?

Maxim Dounin mdounin at mdounin.ru
Tue Oct 12 02:22:30 MSD 2010


Hello!

On Tue, Oct 12, 2010 at 01:45:49AM +0400, Franchoze Eric wrote:

> Is free() needed here?
> 
> ngx_pool_cleanup_t *
> ngx_pool_cleanup_add(ngx_pool_t *p, size_t size)
> {
>     ngx_pool_cleanup_t  *c;
> 
>     c = ngx_palloc(p, sizeof(ngx_pool_cleanup_t));
>     if (c == NULL) {
>         return NULL;
>     }
> 
>     if (size) {
>         c->data = ngx_palloc(p, size);
>         !!! do we need nginx_free(p); here?!!!!

No.

> 
>         if (c->data == NULL) {
>             return NULL;
>         }

Maxim Dounin



More information about the nginx-devel mailing list