mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 05:45:59 +03:00
Recycle the mptmp pool (trac #43).
This commit is contained in:
parent
f508c0a331
commit
8876a03ab1
2
CHANGES
2
CHANGES
@ -2,6 +2,8 @@
|
|||||||
20 Mar 2007 - trunk
|
20 Mar 2007 - trunk
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
|
* Performance improvements in memory management.
|
||||||
|
|
||||||
* Fixed some collection variable names not printing with the parameter
|
* Fixed some collection variable names not printing with the parameter
|
||||||
and/or counting operator in the debug log.
|
and/or counting operator in the debug log.
|
||||||
|
|
||||||
|
26
apache2/re.c
26
apache2/re.c
@ -1269,12 +1269,22 @@ apr_status_t msre_rule_process(msre_rule *rule, modsec_rec *msr) {
|
|||||||
multi_match = 1;
|
multi_match = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create a memory pool that will be used during the
|
/* Use a fresh memory sub-pool for processing each rule */
|
||||||
* processing of this rule only.
|
if (msr->msc_rule_mptmp == NULL) {
|
||||||
*/
|
if (msr->txcfg->debuglog_level >= 9) {
|
||||||
/* IMP1 Why not have one pool and just clear it between rules? */
|
msr_log(msr, 9, "Creating new rule processing memory pool");
|
||||||
if (apr_pool_create(&mptmp, NULL) != APR_SUCCESS) {
|
}
|
||||||
return -1;
|
if (apr_pool_create(&msr->msc_rule_mptmp, msr->mp) != APR_SUCCESS) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
mptmp = msr->msc_rule_mptmp;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mptmp = msr->msc_rule_mptmp;
|
||||||
|
if (msr->txcfg->debuglog_level >= 9) {
|
||||||
|
msr_log(msr, 9, "Clearing rule processing memory pool");
|
||||||
|
}
|
||||||
|
apr_pool_clear(mptmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
tartab = apr_table_make(mptmp, 24);
|
tartab = apr_table_make(mptmp, 24);
|
||||||
@ -1393,7 +1403,6 @@ apr_status_t msre_rule_process(msre_rule *rule, modsec_rec *msr) {
|
|||||||
rc = execute_operator(var, rule, msr, acting_actionset, mptmp);
|
rc = execute_operator(var, rule, msr, acting_actionset, mptmp);
|
||||||
|
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
apr_pool_destroy(mptmp);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1417,7 +1426,6 @@ apr_status_t msre_rule_process(msre_rule *rule, modsec_rec *msr) {
|
|||||||
rc = metadata->execute(mptmp, (unsigned char *)var->value, var->value_len,
|
rc = metadata->execute(mptmp, (unsigned char *)var->value, var->value_len,
|
||||||
&rval, &rval_length);
|
&rval, &rval_length);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
apr_pool_destroy(mptmp);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1443,7 +1451,6 @@ apr_status_t msre_rule_process(msre_rule *rule, modsec_rec *msr) {
|
|||||||
rc = execute_operator(var, rule, msr, acting_actionset, mptmp);
|
rc = execute_operator(var, rule, msr, acting_actionset, mptmp);
|
||||||
|
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
apr_pool_destroy(mptmp);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1461,7 +1468,6 @@ apr_status_t msre_rule_process(msre_rule *rule, modsec_rec *msr) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
apr_pool_destroy(mptmp);
|
|
||||||
|
|
||||||
return (match_count ? RULE_MATCH : RULE_NO_MATCH);
|
return (match_count ? RULE_MATCH : RULE_NO_MATCH);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user