Mercurial > hg > nginx
changeset 4784:dd63abf20ba7
Resolver: fixed possible memory leak in ngx_resolver_create().
Found by Coverity.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 06 Aug 2012 10:48:09 +0000 |
parents | 2220ce29b9d3 |
children | 4163fb9dcfcb |
files | src/core/ngx_resolver.c |
diffstat | 1 files changed, 9 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/core/ngx_resolver.c Fri Aug 03 12:52:32 2012 +0000 +++ b/src/core/ngx_resolver.c Mon Aug 06 10:48:09 2012 +0000 @@ -113,15 +113,6 @@ return NULL; } - if (n) { - if (ngx_array_init(&r->udp_connections, cf->pool, n, - sizeof(ngx_udp_connection_t)) - != NGX_OK) - { - return NULL; - } - } - cln->data = r; r->event = ngx_calloc(sizeof(ngx_event_t), cf->log); @@ -153,6 +144,15 @@ r->log = &cf->cycle->new_log; r->log_level = NGX_LOG_ERR; + if (n) { + if (ngx_array_init(&r->udp_connections, cf->pool, n, + sizeof(ngx_udp_connection_t)) + != NGX_OK) + { + return NULL; + } + } + for (i = 0; i < n; i++) { if (ngx_strncmp(names[i].data, "valid=", 6) == 0) { s.len = names[i].len - 6;