comparison src/core/ngx_resolver.c @ 4892:063ac68d89dc

Resolver: added missing memory allocation error handling.
author Maxim Dounin <mdounin@mdounin.ru>
date Wed, 24 Oct 2012 14:07:08 +0000
parents c85cefbdaafe
children 3d2d3e1cf427
comparison
equal deleted inserted replaced
4891:1e666c78a42c 4892:063ac68d89dc
2142 void *dst, *p; 2142 void *dst, *p;
2143 ngx_uint_t j; 2143 ngx_uint_t j;
2144 2144
2145 dst = ngx_resolver_alloc(r, n * sizeof(in_addr_t)); 2145 dst = ngx_resolver_alloc(r, n * sizeof(in_addr_t));
2146 2146
2147 if (dst == NULL) {
2148 return dst;
2149 }
2150
2147 j = ngx_random() % n; 2151 j = ngx_random() % n;
2148 2152
2149 if (j == 0) { 2153 if (j == 0) {
2150 ngx_memcpy(dst, src, n * sizeof(in_addr_t)); 2154 ngx_memcpy(dst, src, n * sizeof(in_addr_t));
2151 return dst; 2155 return dst;