You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ez...@apache.org on 2019/04/03 16:36:36 UTC

[trafficserver] branch 8.1.x updated: Fix stale heap triggering assert in TSHttpTxnCachedRespGet

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

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


The following commit(s) were added to refs/heads/8.1.x by this push:
     new 8e4b38c  Fix stale heap triggering assert in TSHttpTxnCachedRespGet
8e4b38c is described below

commit 8e4b38cffcdf8ad7284ca96b70f7fba872699fd8
Author: Susan Hinrichs <sh...@oath.com>
AuthorDate: Wed Mar 27 14:07:08 2019 +0000

    Fix stale heap triggering assert in TSHttpTxnCachedRespGet
    
    (cherry picked from commit 5b24c07f7d0b2c52ffeb525712902aa2430347a4)
---
 src/traffic_server/InkAPI.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/traffic_server/InkAPI.cc b/src/traffic_server/InkAPI.cc
index 9169fd8..c732dae 100644
--- a/src/traffic_server/InkAPI.cc
+++ b/src/traffic_server/InkAPI.cc
@@ -4877,9 +4877,10 @@ TSHttpTxnCachedRespGet(TSHttpTxn txnp, TSMBuffer *bufp, TSMLoc *obj)
   HdrHeapSDKHandle **handle = &(sm->t_state.cache_resp_hdr_heap_handle);
 
   if (*handle == nullptr) {
-    *handle           = (HdrHeapSDKHandle *)sm->t_state.arena.alloc(sizeof(HdrHeapSDKHandle));
-    (*handle)->m_heap = cached_hdr->m_heap;
+    *handle = (HdrHeapSDKHandle *)sm->t_state.arena.alloc(sizeof(HdrHeapSDKHandle));
   }
+  // Always reset the m_heap to make sure the heap is not stale
+  (*handle)->m_heap = cached_hdr->m_heap;
 
   *(reinterpret_cast<HdrHeapSDKHandle **>(bufp)) = *handle;
   *obj                                           = reinterpret_cast<TSMLoc>(cached_hdr->m_http);