Skip to content

Commit 3e256b0

Browse files
committed
Small rewording in cleanup handlers
Also, there is no need to set corresponding pointers to NULL as cleanup handler should be called only once (per context).
1 parent 7b8f1ef commit 3e256b0

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

Diff for: src/ngx_http_modsecurity_module.c

+10-14
Original file line numberDiff line numberDiff line change
@@ -699,35 +699,31 @@ static void
699699
ngx_http_modsecurity_cleanup_instance(void *data)
700700
{
701701
ngx_pool_t *old_pool;
702-
ngx_http_modsecurity_main_conf_t *conf;
702+
ngx_http_modsecurity_main_conf_t *mmcf;
703703

704-
conf = (ngx_http_modsecurity_main_conf_t *) data;
704+
mmcf = (ngx_http_modsecurity_main_conf_t *) data;
705705

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

708-
old_pool = ngx_http_modsecurity_pcre_malloc_init(conf->pool);
709-
msc_cleanup(conf->modsec);
708+
old_pool = ngx_http_modsecurity_pcre_malloc_init(mmcf->pool);
709+
msc_cleanup(mmcf->modsec);
710710
ngx_http_modsecurity_pcre_malloc_done(old_pool);
711-
712-
conf->modsec = NULL;
713711
}
714712

715713

716714
static void
717715
ngx_http_modsecurity_cleanup_rules(void *data)
718716
{
719717
ngx_pool_t *old_pool;
720-
ngx_http_modsecurity_conf_t *conf;
718+
ngx_http_modsecurity_conf_t *mcf;
721719

722-
conf = (ngx_http_modsecurity_conf_t *) data;
720+
mcf = (ngx_http_modsecurity_conf_t *) data;
723721

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

726-
old_pool = ngx_http_modsecurity_pcre_malloc_init(conf->pool);
727-
msc_rules_cleanup(conf->rules_set);
724+
old_pool = ngx_http_modsecurity_pcre_malloc_init(mcf->pool);
725+
msc_rules_cleanup(mcf->rules_set);
728726
ngx_http_modsecurity_pcre_malloc_done(old_pool);
729-
730-
conf->rules_set = NULL;
731727
}
732728

733729

0 commit comments

Comments
 (0)