You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2015/08/25 21:26:08 UTC

trafficserver git commit: TS-3862 Allocate memory for the lookup URL if needed

Repository: trafficserver
Updated Branches:
  refs/heads/master 4a7e12567 -> 5ef29dd2f


TS-3862 Allocate memory for the lookup URL if needed

There are some cases where it might not already be allocated,
so we should ensure that we do so. Thanks Sudheer.


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/5ef29dd2
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/5ef29dd2
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/5ef29dd2

Branch: refs/heads/master
Commit: 5ef29dd2f935526d92a0b0fc12ef52cdc1c698cb
Parents: 4a7e125
Author: Leif Hedstrom <zw...@apache.org>
Authored: Fri Aug 21 16:28:31 2015 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Tue Aug 25 11:23:53 2015 -0600

----------------------------------------------------------------------
 proxy/InkAPI.cc | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5ef29dd2/proxy/InkAPI.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index b49ac5e..65c5ba0 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -4868,16 +4868,24 @@ TSHttpTxnCacheLookupUrlSet(TSHttpTxn txnp, TSMBuffer bufp, TSMLoc obj)
 
   u.m_heap = ((HdrHeapSDKHandle *)bufp)->m_heap;
   u.m_url_impl = (URLImpl *)obj;
-  if (!u.valid())
+  if (!u.valid()) {
     return TS_ERROR;
+  }
 
   l_url = sm->t_state.cache_info.lookup_url;
-  if (l_url && l_url->valid()) {
+  if (!l_url) {
+    sm->t_state.cache_info.lookup_url_storage.create(NULL);
+    sm->t_state.cache_info.lookup_url = &(sm->t_state.cache_info.lookup_url_storage);
+    l_url = sm->t_state.cache_info.lookup_url;
+  }
+
+  if (!l_url || !l_url->valid()) {
+    return TS_ERROR;
+  } else {
     l_url->copy(&u);
-    return TS_SUCCESS;
   }
 
-  return TS_ERROR;
+  return TS_SUCCESS;
 }
 
 // TS-1996: This API will be removed after v3.4.0 is cut. Do not use it!