[TS-4135] fix redirect coredump

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

Branch: refs/heads/master
Commit: d42bad1917cf05b9cbc4a3ff5b5bbdb182a0599b
Parents: af72c71
Author: Sandeep Davu <[email protected]>
Authored: Fri Jan 29 00:13:00 2016 +0000
Committer: Sudheer Vinukonda <[email protected]>
Committed: Mon Feb 1 17:32:26 2016 +0000

----------------------------------------------------------------------
 lib/atscppapi/src/Request.cc     |  5 -----
 lib/atscppapi/src/Transaction.cc | 34 +++++-----------------------------
 2 files changed, 5 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d42bad19/lib/atscppapi/src/Request.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/Request.cc b/lib/atscppapi/src/Request.cc
index 6e1166e..250f4f5 100644
--- a/lib/atscppapi/src/Request.cc
+++ b/lib/atscppapi/src/Request.cc
@@ -84,11 +84,6 @@ Request::Request(const string &url_str, HttpMethod method, 
HttpVersion version)
 void
 Request::init(void *hdr_buf, void *hdr_loc)
 {
-  if (state_->hdr_buf_ || state_->hdr_loc_) {
-    LOG_ERROR("Reinitialization; (hdr_buf, hdr_loc) current(%p, %p), 
attempted(%p, %p)", state_->hdr_buf_, state_->hdr_loc_,
-              hdr_buf, hdr_loc);
-    return;
-  }
   state_->hdr_buf_ = static_cast<TSMBuffer>(hdr_buf);
   state_->hdr_loc_ = static_cast<TSMLoc>(hdr_loc);
   state_->headers_.reset(state_->hdr_buf_, state_->hdr_loc_);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d42bad19/lib/atscppapi/src/Transaction.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/Transaction.cc b/lib/atscppapi/src/Transaction.cc
index b9396ef..8790c00 100644
--- a/lib/atscppapi/src/Transaction.cc
+++ b/lib/atscppapi/src/Transaction.cc
@@ -86,28 +86,6 @@ Transaction::Transaction(void *raw_txn)
 Transaction::~Transaction()
 {
   LOG_DEBUG("Transaction tshttptxn=%p destroying Transaction object %p", 
state_->txn_, this);
-  static const TSMLoc NULL_PARENT_LOC = NULL;
-  TSHandleMLocRelease(state_->client_request_hdr_buf_, NULL_PARENT_LOC, 
state_->client_request_hdr_loc_);
-  if (state_->server_request_hdr_buf_ && state_->server_request_hdr_loc_) {
-    LOG_DEBUG("Releasing server request");
-    TSHandleMLocRelease(state_->server_request_hdr_buf_, NULL_PARENT_LOC, 
state_->server_request_hdr_loc_);
-  }
-  if (state_->server_response_hdr_buf_ && state_->server_response_hdr_loc_) {
-    LOG_DEBUG("Releasing server response");
-    TSHandleMLocRelease(state_->server_response_hdr_buf_, NULL_PARENT_LOC, 
state_->server_response_hdr_loc_);
-  }
-  if (state_->client_response_hdr_buf_ && state_->client_response_hdr_loc_) {
-    LOG_DEBUG("Releasing client response");
-    TSHandleMLocRelease(state_->client_response_hdr_buf_, NULL_PARENT_LOC, 
state_->client_response_hdr_loc_);
-  }
-  if (state_->cached_request_hdr_buf_ && state_->cached_request_hdr_loc_) {
-    LOG_DEBUG("Releasing cached request");
-    TSHandleMLocRelease(state_->cached_request_hdr_buf_, NULL_PARENT_LOC, 
state_->cached_request_hdr_loc_);
-  }
-  if (state_->cached_response_hdr_buf_ && state_->cached_response_hdr_loc_) {
-    LOG_DEBUG("Releasing cached response");
-    TSHandleMLocRelease(state_->cached_response_hdr_buf_, NULL_PARENT_LOC, 
state_->cached_response_hdr_loc_);
-  }
   delete state_;
 }
 
@@ -433,14 +411,12 @@ public:
   initializeHandles(GetterFunction getter) : getter_(getter) {}
   bool operator()(TSHttpTxn txn, TSMBuffer &hdr_buf, TSMLoc &hdr_loc, const 
char *handles_name)
   {
-    if (!hdr_buf && !hdr_loc) {
-      if (getter_(txn, &hdr_buf, &hdr_loc) == TS_SUCCESS) {
-        return true;
-      } else {
-        LOG_ERROR("Could not get %s", handles_name);
-      }
+    hdr_buf = NULL;
+    hdr_loc = NULL;
+    if (getter_(txn, &hdr_buf, &hdr_loc) == TS_SUCCESS) {
+      return true;
     } else {
-      LOG_ERROR("%s already initialized", handles_name);
+      LOG_ERROR("Could not get %s", handles_name);
     }
     return false;
   }

Reply via email to