Merge pull request #59 from defanator/defanator-fix-auto_reload
Ensure that database structures are zero-initialized
This commit is contained in:
commit
cbea8fc505
2 changed files with 4 additions and 12 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue