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

cmcfarlen 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 c9bd053c64 Avoid arena temporary. (#10978)
c9bd053c64 is described below

commit c9bd053c64d5110f7324e4fe98db2e6babeb5d00
Author: Chris McFarlen <[email protected]>
AuthorDate: Thu Feb 8 12:01:48 2024 -0600

    Avoid arena temporary. (#10978)
    
    * Avoid arena temporary.
    
    * destroy redirect_url after calling build_error_response
    
    ---------
    
    Co-authored-by: Chris McFarlen <[email protected]>
---
 src/proxy/http/HttpTransact.cc | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/proxy/http/HttpTransact.cc b/src/proxy/http/HttpTransact.cc
index 87d2975591..a57aed0a71 100644
--- a/src/proxy/http/HttpTransact.cc
+++ b/src/proxy/http/HttpTransact.cc
@@ -1480,10 +1480,7 @@ HttpTransact::handleIfRedirect(State *s)
 
   answer = request_url_remap_redirect(&s->hdr_info.client_request, 
&redirect_url, s->state_machine->m_remap);
   if ((answer == PERMANENT_REDIRECT) || (answer == TEMPORARY_REDIRECT)) {
-    int remap_redirect_len;
-
-    s->remap_redirect = redirect_url.string_get(&s->arena, 
&remap_redirect_len);
-    redirect_url.destroy();
+    s->remap_redirect = redirect_url.string_get_ref(nullptr);
     if (answer == TEMPORARY_REDIRECT) {
       if ((s->client_info).http_version == HTTP_1_1) {
         build_error_response(s, HTTP_STATUS_TEMPORARY_REDIRECT, "Redirect", 
"redirect#moved_temporarily");
@@ -1493,8 +1490,8 @@ HttpTransact::handleIfRedirect(State *s)
     } else {
       build_error_response(s, HTTP_STATUS_MOVED_PERMANENTLY, "Redirect", 
"redirect#moved_permanently");
     }
-    s->arena.str_free(s->remap_redirect);
     s->remap_redirect = nullptr;
+    redirect_url.destroy();
     return true;
   }
 

Reply via email to