Skip to content

The pool pointer is now available for ngx_http_modsecurity_config_cleanup #87

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/ngx_http_modsecurity_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ typedef struct {
ngx_flag_t sanity_checks_enabled;

Rules *rules_set;

void *pool;
} ngx_http_modsecurity_conf_t;


Expand Down
3 changes: 2 additions & 1 deletion src/ngx_http_modsecurity_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,7 @@ static void *ngx_http_modsecurity_create_conf(ngx_conf_t *cf)
conf->sanity_checks_enabled = NGX_CONF_UNSET;
conf->rules_set = msc_create_rules_set();
conf->modsec = NULL;
conf->pool = cf->pool;

cln = ngx_pool_cleanup_add(cf->pool, 0);
if (cln == NULL) {
Expand Down Expand Up @@ -658,7 +659,7 @@ ngx_http_modsecurity_config_cleanup(void *data)

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

old_pool = ngx_http_modsecurity_pcre_malloc_init(NULL);
old_pool = ngx_http_modsecurity_pcre_malloc_init(t->pool);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regardless the parameter here I guess the end result will be the same.

Copy link
Contributor

@zimmerle zimmerle Mar 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh wait, i think i've get your point. let me discuss with @defanator.

msc_rules_cleanup(t->rules_set);
msc_cleanup(t->modsec);
ngx_http_modsecurity_pcre_malloc_done(old_pool);
Expand Down