This is an automated email from the ASF dual-hosted git repository.
eze pushed a commit to branch 9.2.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/9.2.x by this push:
new 90cb116e6c Fix crash by including remap files with named filters
(#11997) (#11998)
90cb116e6c is described below
commit 90cb116e6c025304e4fd2b87667136f4a214583f
Author: Evan Zelkowitz <[email protected]>
AuthorDate: Tue Jan 28 17:59:56 2025 -0700
Fix crash by including remap files with named filters (#11997) (#11998)
* Fix crash by including remap files with named filters (#11997)
* Fix crash by including remap files with named filters
* Fix unit test
(cherry picked from commit 4c9c7c63dcddc60c473509f66a262a09593f9b2e)
* Fix spacing
---------
Co-authored-by: Masaori Koshiba <[email protected]>
---
proxy/http/remap/RemapConfig.cc | 22 ++++++++++++++--------
proxy/http/remap/RemapConfig.h | 3 +++
2 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/proxy/http/remap/RemapConfig.cc b/proxy/http/remap/RemapConfig.cc
index d1e1326a63..2d92533bd7 100644
--- a/proxy/http/remap/RemapConfig.cc
+++ b/proxy/http/remap/RemapConfig.cc
@@ -91,14 +91,6 @@ BUILD_TABLE_INFO::BUILD_TABLE_INFO()
BUILD_TABLE_INFO::~BUILD_TABLE_INFO()
{
this->reset();
-
- // clean up any leftover named filter rules
- auto *rp = rules_list;
- while (rp != nullptr) {
- auto *tmp = rp->next;
- delete rp;
- rp = tmp;
- }
}
void
@@ -109,6 +101,18 @@ BUILD_TABLE_INFO::reset()
clear_xstr_array(this->argv, sizeof(this->argv) / sizeof(char *));
}
+void
+BUILD_TABLE_INFO::clear_acl_rules_list()
+{
+ // clean up any leftover named filter rules
+ auto *rp = rules_list;
+ while (rp != nullptr) {
+ auto *tmp = rp->next;
+ delete rp;
+ rp = tmp;
+ }
+}
+
static const char *
process_filter_opt(url_mapping *mp, const BUILD_TABLE_INFO *bti, char
*errStrBuf, int errStrBufSize)
{
@@ -1381,5 +1385,7 @@ remap_parse_config(const char *path, UrlRewrite *rewrite)
* accordingly notify all plugins that we are done */
rewrite->pluginFactory.indicatePostReload(status);
+ bti.clear_acl_rules_list();
+
return status;
}
diff --git a/proxy/http/remap/RemapConfig.h b/proxy/http/remap/RemapConfig.h
index 20c7d07c0e..26a670cda2 100644
--- a/proxy/http/remap/RemapConfig.h
+++ b/proxy/http/remap/RemapConfig.h
@@ -61,6 +61,9 @@ struct BUILD_TABLE_INFO {
// Clear the argument vector.
void reset();
+ // Free acl_filter_rule in the list
+ void clear_acl_rules_list();
+
// noncopyable
BUILD_TABLE_INFO(const BUILD_TABLE_INFO &) = delete; // disabled
BUILD_TABLE_INFO &operator=(const BUILD_TABLE_INFO &) = delete; // disabled