This is an automated email from the ASF dual-hosted git repository.
mochen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new f373755b16 Cripts: tighten context cleanup (#12725)
f373755b16 is described below
commit f373755b16eafbe3cb423fdf033e9699dc17ac3f
Author: Mo Chen <[email protected]>
AuthorDate: Wed Dec 3 15:52:03 2025 -0600
Cripts: tighten context cleanup (#12725)
---
include/cripts/Urls.hpp | 5 +++++
src/cripts/Context.cc | 1 +
src/cripts/Urls.cc | 4 ++--
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/include/cripts/Urls.hpp b/include/cripts/Urls.hpp
index ed4521e7a1..c28f1d1dab 100644
--- a/include/cripts/Urls.hpp
+++ b/include/cripts/Urls.hpp
@@ -654,9 +654,14 @@ namespace Client
void operator=(const self_type &) = delete;
// We must not release the bufp etc. since it comes from the RRI structure
+ // However, we still need to clear cached data in query and path components
void
Reset() override
{
+ query.Reset();
+ path.Reset();
+ _initialized = false;
+ _modified = false;
}
static self_type &_get(cripts::Context *context);
diff --git a/src/cripts/Context.cc b/src/cripts/Context.cc
index d71473e3d2..76bcc822b2 100644
--- a/src/cripts/Context.cc
+++ b/src/cripts/Context.cc
@@ -69,6 +69,7 @@ Context::Factory(TSHttpTxn txn_ptr, TSHttpSsn ssn_ptr,
TSRemapRequestInfo *rri_p
void
Context::Release()
{
+ reset(); // Clear mloc handles before freeing
THREAD_FREE(this, criptContextAllocator, this_thread());
}
diff --git a/src/cripts/Urls.cc b/src/cripts/Urls.cc
index 57abcb5ad9..f47e49f371 100644
--- a/src/cripts/Urls.cc
+++ b/src/cripts/Urls.cc
@@ -197,7 +197,7 @@ Url::Path::Reset()
Component::Reset();
_segments.clear();
- _storage = "";
+ _storage.clear();
_size = 0;
_modified = false;
}
@@ -402,7 +402,7 @@ Url::Query::Reset()
_ordered.clear();
_hashed.clear();
- _storage = "";
+ _storage.clear();
_size = 0;
_modified = false;
}