You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by am...@apache.org on 2018/05/10 10:50:30 UTC

[trafficserver] branch master updated: Suppress clang-analyzer's erroneous complaint about use-after-free.

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

amc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 3e36da7  Suppress clang-analyzer's erroneous complaint about use-after-free.
3e36da7 is described below

commit 3e36da7c8d04b5796eb5c554d786119a1ca3ba23
Author: Chris Lemmons <al...@gmail.com>
AuthorDate: Tue May 8 15:01:15 2018 +0000

    Suppress clang-analyzer's erroneous complaint about use-after-free.
---
 proxy/logging/LogHost.cc | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/proxy/logging/LogHost.cc b/proxy/logging/LogHost.cc
index 3d7f401..40a940d 100644
--- a/proxy/logging/LogHost.cc
+++ b/proxy/logging/LogHost.cc
@@ -418,18 +418,31 @@ LogHostList::preproc_and_try_delete(LogBuffer *lb)
     available_host = lh;
 
     do {
+#ifndef __clang_analyzer__
       ink_atomic_increment(&lb->m_references, 1);
-      success     = lh->preproc_and_try_delete(lb);
+      success = lh->preproc_and_try_delete(lb);
+#else
+      /* clang-analyzer cannot be sure that lb->m_references
+       * isn't being modified problematically simultaneously
+       * in other threads. It, however, mustn't be or all is
+       * already lost. Suppress clang-analyzer for this case
+       * so that it does not erroneously believe a use after
+       * free occurs here.
+       */
+      success = false;
+#endif
       need_orphan = need_orphan && (success == false);
     } while (lb && (success == false) && (lh = lh->failover_link.next));
 
     nr--;
   }
 
+#ifndef __clang_analyzer__
   if (need_orphan && available_host) {
     ink_atomic_increment(&lb->m_references, 1);
     available_host->orphan_write_and_try_delete(lb);
   }
+#endif
 
   LogBuffer::destroy(lb);
   return 0;

-- 
To stop receiving notification emails like this one, please contact
amc@apache.org.