mirror of
https://github.com/nginx/nginx.git
synced 2025-06-07 17:52:38 +08:00
Resolver: fixed possible memory leak in ngx_resolver_create().
Found by Coverity.
This commit is contained in:
parent
8ed4929a26
commit
42a75bba53
@ -113,15 +113,6 @@ ngx_resolver_create(ngx_conf_t *cf, ngx_str_t *names, ngx_uint_t n)
|
|||||||
return NULL;
|
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;
|
cln->data = r;
|
||||||
|
|
||||||
r->event = ngx_calloc(sizeof(ngx_event_t), cf->log);
|
r->event = ngx_calloc(sizeof(ngx_event_t), cf->log);
|
||||||
@ -153,6 +144,15 @@ ngx_resolver_create(ngx_conf_t *cf, ngx_str_t *names, ngx_uint_t n)
|
|||||||
r->log = &cf->cycle->new_log;
|
r->log = &cf->cycle->new_log;
|
||||||
r->log_level = NGX_LOG_ERR;
|
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++) {
|
for (i = 0; i < n; i++) {
|
||||||
if (ngx_strncmp(names[i].data, "valid=", 6) == 0) {
|
if (ngx_strncmp(names[i].data, "valid=", 6) == 0) {
|
||||||
s.len = names[i].len - 6;
|
s.len = names[i].len - 6;
|
||||||
|
Loading…
Reference in New Issue
Block a user