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 2019/11/04 16:34:43 UTC

[trafficserver] branch 9.0.x updated: Fix null pointer dereference reported by clang-analyzer

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

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


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 6b44697  Fix null pointer dereference reported by clang-analyzer
6b44697 is described below

commit 6b44697625296da6cb98889b949fc307a99dd3ed
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Fri Nov 1 14:45:52 2019 +0900

    Fix null pointer dereference reported by clang-analyzer
    
    (cherry picked from commit 33a5ebe303361076ef636d1590faf31c7f44cc57)
---
 proxy/http/HttpTunnel.cc | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/proxy/http/HttpTunnel.cc b/proxy/http/HttpTunnel.cc
index 882e1e5..97e3cc9 100644
--- a/proxy/http/HttpTunnel.cc
+++ b/proxy/http/HttpTunnel.cc
@@ -1182,8 +1182,12 @@ HttpTunnel::producer_handler(int event, HttpTunnelProducer *p)
   case VC_EVENT_INACTIVITY_TIMEOUT:
   case HTTP_TUNNEL_EVENT_CONSUMER_DETACH:
     if (p->alive) {
-      p->alive      = false;
-      p->bytes_read = p->read_vio->ndone;
+      p->alive = false;
+      if (p->read_vio) {
+        p->bytes_read = p->read_vio->ndone;
+      } else {
+        p->bytes_read = 0;
+      }
       // Clear any outstanding reads so they don't
       // collide with future tunnel IO's
       p->vc->do_io_read(nullptr, 0, nullptr);