comparison src/core/ngx_resolver.c @ 4514:79142134d616 stable-1.0

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.
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 05 Mar 2012 13:06:29 +0000
parents 4919fb357a5d
children 8bb695c05870
comparison
equal deleted inserted replaced
4513:2dfa4d76e4c5 4514:79142134d616
150 r->udp_connection = uc; 150 r->udp_connection = uc;
151 151
152 uc->sockaddr = addr->sockaddr; 152 uc->sockaddr = addr->sockaddr;
153 uc->socklen = addr->socklen; 153 uc->socklen = addr->socklen;
154 uc->server = addr->name; 154 uc->server = addr->name;
155
156 uc->log = cf->cycle->new_log;
157 uc->log.handler = ngx_resolver_log_error;
158 uc->log.data = uc;
159 uc->log.action = "resolving";
160 } 155 }
161 156
162 return r; 157 return r;
163 } 158 }
164 159
828 ngx_udp_connection_t *uc; 823 ngx_udp_connection_t *uc;
829 824
830 uc = r->udp_connection; 825 uc = r->udp_connection;
831 826
832 if (uc->connection == NULL) { 827 if (uc->connection == NULL) {
828
829 uc->log = *r->log;
830 uc->log.handler = ngx_resolver_log_error;
831 uc->log.data = uc;
832 uc->log.action = "resolving";
833
833 if (ngx_udp_connect(uc) != NGX_OK) { 834 if (ngx_udp_connect(uc) != NGX_OK) {
834 return NGX_ERROR; 835 return NGX_ERROR;
835 } 836 }
836 837
837 uc->connection->data = r; 838 uc->connection->data = r;