diff --git a/ngx_http_geoip2_module.c b/ngx_http_geoip2_module.c index c28eb00..e3e3cb7 100644 --- a/ngx_http_geoip2_module.c +++ b/ngx_http_geoip2_module.c @@ -426,6 +426,8 @@ ngx_http_geoip2(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) return NGX_CONF_ERROR; } + ngx_memzero(database, sizeof(ngx_http_geoip2_db_t)); + database->last_check = database->last_change = ngx_time(); status = MMDB_open((char *) value[1].data, MMDB_MODE_MMAP, &database->mmdb); @@ -437,12 +439,6 @@ ngx_http_geoip2(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) return NGX_CONF_ERROR; } -#if (NGX_HAVE_INET6) - ngx_memset(&database->address, 0, sizeof(database->address)); -#else - database->address = 0; -#endif - save = *cf; cf->handler = ngx_http_geoip2_parse_config; cf->handler_conf = (void *) database; diff --git a/ngx_stream_geoip2_module.c b/ngx_stream_geoip2_module.c index b9d0260..f988e6a 100644 --- a/ngx_stream_geoip2_module.c +++ b/ngx_stream_geoip2_module.c @@ -395,6 +395,8 @@ ngx_stream_geoip2(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) return NGX_CONF_ERROR; } + ngx_memzero(database, sizeof(ngx_stream_geoip2_db_t)); + database->last_check = database->last_change = ngx_time(); status = MMDB_open((char *) value[1].data, MMDB_MODE_MMAP, &database->mmdb); @@ -406,12 +408,6 @@ ngx_stream_geoip2(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) return NGX_CONF_ERROR; } -#if (NGX_HAVE_INET6) - ngx_memset(&database->address, 0, sizeof(database->address)); -#else - database->address = 0; -#endif - save = *cf; cf->handler = ngx_stream_geoip2_parse_config; cf->handler_conf = (void *) database;