You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by no...@apache.org on 2017/01/24 21:00:02 UTC

[trafficserver] branch master updated: Fix CID 1368305: Dereference before null check

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

nottheoilrig pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/master by this push:
       new  01109c0   Fix CID 1368305: Dereference before null check
01109c0 is described below

commit 01109c06856b41f9f11f18bc8197ace85e822964
Author: Jack Bates <ja...@nottheoilrig.com>
AuthorDate: Wed Jan 18 16:04:12 2017 -0700

    Fix CID 1368305: Dereference before null check
    
    #1302
---
 plugins/experimental/money_trace/money_trace.cc | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/plugins/experimental/money_trace/money_trace.cc b/plugins/experimental/money_trace/money_trace.cc
index da8acc1..f76df7a 100644
--- a/plugins/experimental/money_trace/money_trace.cc
+++ b/plugins/experimental/money_trace/money_trace.cc
@@ -120,17 +120,13 @@ mt_check_request_header(TSHttpTxn txnp)
       if (!hdr_value || length <= 0) {
         LOG_DEBUG("ignoring, corrupt money trace header.");
       } else {
-        txn_data                                   = allocTransactionData();
-        txn_data->client_request_mt_header         = TSstrndup(hdr_value, length);
-        txn_data->client_request_mt_header[length] = '\0'; // workaround for bug in core.
-        LOG_DEBUG("found money trace header: %s, length: %d", txn_data->client_request_mt_header, length);
         if (nullptr == (contp = TSContCreate(transaction_handler, nullptr))) {
           LOG_ERROR("failed to create the transaction handler continuation");
-          if (nullptr != txn_data) {
-            TSfree(txn_data->client_request_mt_header);
-            TSfree(txn_data);
-          }
         } else {
+          txn_data                                   = allocTransactionData();
+          txn_data->client_request_mt_header         = TSstrndup(hdr_value, length);
+          txn_data->client_request_mt_header[length] = '\0'; // workaround for bug in core.
+          LOG_DEBUG("found money trace header: %s, length: %d", txn_data->client_request_mt_header, length);
           TSContDataSet(contp, txn_data);
           TSHttpTxnHookAdd(txnp, TS_HTTP_CACHE_LOOKUP_COMPLETE_HOOK, contp);
           TSHttpTxnHookAdd(txnp, TS_HTTP_TXN_CLOSE_HOOK, contp);

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].