]> git.kaiwu.me - nginx.git/commitdiff
create empty radix tree for "geo $geo { }" case
authorIgor Sysoev <igor@sysoev.ru>
Fri, 28 Nov 2008 17:22:35 +0000 (17:22 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Fri, 28 Nov 2008 17:22:35 +0000 (17:22 +0000)
src/http/modules/ngx_http_geo_module.c

index 5fc63210c1c1d7023f5babe1854b6a64784d59cf..bba399f6c094e5901ba2fac14a18d7465aee3369 100644 (file)
@@ -255,6 +255,13 @@ ngx_http_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
         }
 
     } else {
+        if (ctx.tree == NULL) {
+            ctx.tree = ngx_radix_tree_create(cf->pool, -1);
+            if (ctx.tree == NULL) {
+                return NGX_CONF_ERROR;
+            }
+        }
+
         var->get_handler = ngx_http_geo_cidr_variable;
         var->data = (uintptr_t) ctx.tree;