comparison src/http/modules/ngx_http_geoip_module.c @ 3741:0f9b2d285bfc

fix segfault, the bug has been introduced in r3738
author Igor Sysoev <igor@sysoev.ru>
date Tue, 03 Aug 2010 18:27:56 +0000
parents 18ae5f09a53d
children 01691af60f94
comparison
equal deleted inserted replaced
3740:fe2688c9e9bd 3741:0f9b2d285bfc
272 if (gr == NULL) { 272 if (gr == NULL) {
273 goto not_found; 273 goto not_found;
274 } 274 }
275 275
276 val = GeoIP_region_name_by_code(gr->country_code, gr->region); 276 val = GeoIP_region_name_by_code(gr->country_code, gr->region);
277 if (val == NULL) {
278 goto no_value;
279 }
277 280
278 len = ngx_strlen(val); 281 len = ngx_strlen(val);
279 v->data = ngx_pnalloc(r->pool, len); 282 v->data = ngx_pnalloc(r->pool, len);
280 283
281 if (v->data == NULL) { 284 if (v->data == NULL) {
291 v->not_found = 0; 294 v->not_found = 0;
292 295
293 GeoIPRecord_delete(gr); 296 GeoIPRecord_delete(gr);
294 297
295 return NGX_OK; 298 return NGX_OK;
299
300 no_value:
301
302 GeoIPRecord_delete(gr);
296 303
297 not_found: 304 not_found:
298 305
299 v->not_found = 1; 306 v->not_found = 1;
300 307