Merge of r4497:
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
8 years ago
151 | 151 | uc->sockaddr = addr->sockaddr; |
152 | 152 | uc->socklen = addr->socklen; |
153 | 153 | uc->server = addr->name; |
154 | ||
155 | uc->log = cf->cycle->new_log; | |
156 | uc->log.handler = ngx_resolver_log_error; | |
157 | uc->log.data = uc; | |
158 | uc->log.action = "resolving"; | |
159 | 154 | } |
160 | 155 | |
161 | 156 | return r; |
829 | 824 | uc = r->udp_connection; |
830 | 825 | |
831 | 826 | if (uc->connection == NULL) { |
827 | ||
828 | uc->log = *r->log; | |
829 | uc->log.handler = ngx_resolver_log_error; | |
830 | uc->log.data = uc; | |
831 | uc->log.action = "resolving"; | |
832 | ||
832 | 833 | if (ngx_udp_connect(uc) != NGX_OK) { |
833 | 834 | return NGX_ERROR; |
834 | 835 | } |