because it returns a statically allocated string
len = ngx_strlen(val);
v->data = ngx_pnalloc(r->pool, len);
-
if (v->data == NULL) {
GeoIPRecord_delete(gr);
return NGX_ERROR;
}
val = GeoIP_region_name_by_code(gr->country_code, gr->region);
+
+ GeoIPRecord_delete(gr);
+
if (val == NULL) {
- goto no_value;
+ goto not_found;
}
len = ngx_strlen(val);
v->data = ngx_pnalloc(r->pool, len);
-
if (v->data == NULL) {
- GeoIPRecord_delete(gr);
return NGX_ERROR;
}
v->no_cacheable = 0;
v->not_found = 0;
- GeoIPRecord_delete(gr);
-
return NGX_OK;
-no_value:
-
- GeoIPRecord_delete(gr);
-
not_found:
v->not_found = 1;