Skip to content

Commit

Permalink
Small rewording in cleanup handlers
Browse files Browse the repository at this point in the history
Also, there is no need to set corresponding pointers to NULL as cleanup
handler should be called only once (per context).
  • Loading branch information
defanator committed Nov 30, 2018
1 parent 7b8f1ef commit 3e256b0
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions src/ngx_http_modsecurity_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -699,35 +699,31 @@ static void
ngx_http_modsecurity_cleanup_instance(void *data)
{
ngx_pool_t *old_pool;
ngx_http_modsecurity_main_conf_t *conf;
ngx_http_modsecurity_main_conf_t *mmcf;

conf = (ngx_http_modsecurity_main_conf_t *) data;
mmcf = (ngx_http_modsecurity_main_conf_t *) data;

dd("deleting a main conf -- instance is: \"%p\"", conf->modsec);
dd("deleting a main conf -- instance is: \"%p\"", mmcf->modsec);

old_pool = ngx_http_modsecurity_pcre_malloc_init(conf->pool);
msc_cleanup(conf->modsec);
old_pool = ngx_http_modsecurity_pcre_malloc_init(mmcf->pool);
msc_cleanup(mmcf->modsec);
ngx_http_modsecurity_pcre_malloc_done(old_pool);

conf->modsec = NULL;
}


static void
ngx_http_modsecurity_cleanup_rules(void *data)
{
ngx_pool_t *old_pool;
ngx_http_modsecurity_conf_t *conf;
ngx_http_modsecurity_conf_t *mcf;

conf = (ngx_http_modsecurity_conf_t *) data;
mcf = (ngx_http_modsecurity_conf_t *) data;

dd("deleting a loc conf -- RuleSet is: \"%p\"", conf->rules_set);
dd("deleting a loc conf -- RuleSet is: \"%p\"", mcf->rules_set);

old_pool = ngx_http_modsecurity_pcre_malloc_init(conf->pool);
msc_rules_cleanup(conf->rules_set);
old_pool = ngx_http_modsecurity_pcre_malloc_init(mcf->pool);
msc_rules_cleanup(mcf->rules_set);
ngx_http_modsecurity_pcre_malloc_done(old_pool);

conf->rules_set = NULL;
}


Expand Down

0 comments on commit 3e256b0

Please sign in to comment.