# HG changeset patch # User Maxim Dounin # Date 1330361822 0 # Node ID be6c250b827b017315b34681e4dd760f1cf27cbc # Parent b4379a91f9b59c7cf0e6b0950ff71d63ec3f4bdc Fixed null pointer dereference in resolver (ticket #91). The cycle->new_log.file may not be set before config parsing finished if there are no error_log directive defined at global level. Fix is to copy it after config parsing. Patch by Roman Arutyunyan. diff -r b4379a91f9b5 -r be6c250b827b src/core/ngx_resolver.c --- a/src/core/ngx_resolver.c Mon Feb 27 16:54:10 2012 +0000 +++ b/src/core/ngx_resolver.c Mon Feb 27 16:57:02 2012 +0000 @@ -189,11 +189,6 @@ uc->sockaddr = u.addrs->sockaddr; uc->socklen = u.addrs->socklen; uc->server = u.addrs->name; - - uc->log = cf->cycle->new_log; - uc->log.handler = ngx_resolver_log_error; - uc->log.data = uc; - uc->log.action = "resolving"; } return r; @@ -876,6 +871,12 @@ } if (uc->connection == NULL) { + + uc->log = *r->log; + uc->log.handler = ngx_resolver_log_error; + uc->log.data = uc; + uc->log.action = "resolving"; + if (ngx_udp_connect(uc) != NGX_OK) { return NGX_ERROR; }