This is an automated email from the ASF dual-hosted git repository.

cmcfarlen pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/10.1.x by this push:
     new d09c258fa5 Cripts: tighten context cleanup (#12725)
d09c258fa5 is described below

commit d09c258fa597d79d1f9e2fef3451fc63f922803b
Author: Mo Chen <[email protected]>
AuthorDate: Wed Dec 3 15:52:03 2025 -0600

    Cripts: tighten context cleanup (#12725)
    
    (cherry picked from commit f373755b16eafbe3cb423fdf033e9699dc17ac3f)
---
 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 eba50c64f0..02cbee652d 100644
--- a/include/cripts/Urls.hpp
+++ b/include/cripts/Urls.hpp
@@ -652,9 +652,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 536f8bfde2..e0bcb1acbc 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 fda6e8e838..74416c5bd5 100644
--- a/src/cripts/Urls.cc
+++ b/src/cripts/Urls.cc
@@ -196,7 +196,7 @@ Url::Path::Reset()
   Component::Reset();
 
   _segments.clear();
-  _storage  = "";
+  _storage.clear();
   _size     = 0;
   _modified = false;
 }
@@ -401,7 +401,7 @@ Url::Query::Reset()
 
   _ordered.clear();
   _hashed.clear();
-  _storage  = "";
+  _storage.clear();
   _size     = 0;
   _modified = false;
 }

Reply via email to