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.
Maxim Dounin
10 years ago
188 | 188 | uc->sockaddr = u.addrs->sockaddr; |
189 | 189 | uc->socklen = u.addrs->socklen; |
190 | 190 | uc->server = u.addrs->name; |
191 | ||
192 | uc->log = cf->cycle->new_log; | |
193 | uc->log.handler = ngx_resolver_log_error; | |
194 | uc->log.data = uc; | |
195 | uc->log.action = "resolving"; | |
196 | 191 | } |
197 | 192 | |
198 | 193 | return r; |
875 | 870 | } |
876 | 871 | |
877 | 872 | if (uc->connection == NULL) { |
873 | ||
874 | uc->log = *r->log; | |
875 | uc->log.handler = ngx_resolver_log_error; | |
876 | uc->log.data = uc; | |
877 | uc->log.action = "resolving"; | |
878 | ||
878 | 879 | if (ngx_udp_connect(uc) != NGX_OK) { |
879 | 880 | return NGX_ERROR; |
880 | 881 | } |