memory leak at ngx_pool_cleanup_add ?

Franchoze Eric franchoze at yandex.ru
Tue Oct 12 20:59:13 MSD 2010



12.10.10, 01:45, "Franchoze Eric" <franchoze at yandex.ru>:

> 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?!!!!
>  
>          if (c->data == NULL) {
>              return NULL;
>          }
>  

Opps, I mean nginx_free(c) of cource. It is allocated in lines above and if c->data is not allotated it just returns from function without freeing c.




More information about the nginx-devel mailing list