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 c2cc786  clang-analyzer: uninitialized va_list (#6798)
c2cc786 is described below

commit c2cc7863f170a4d1ed9139db34b074554717a8a3
Author: Leif Hedstrom <zw...@apache.org>
AuthorDate: Wed May 20 09:23:48 2020 -0600

    clang-analyzer: uninitialized va_list (#6798)
    
    (cherry picked from commit 0c9fab53bd820c24b3f02cbb01d5a981053ca990)
---
 src/tscore/Diags.cc | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/tscore/Diags.cc b/src/tscore/Diags.cc
index 5f42bc9..bc143f0 100644
--- a/src/tscore/Diags.cc
+++ b/src/tscore/Diags.cc
@@ -460,15 +460,12 @@ Diags::dump(FILE *fp) const
 void
 Diags::error_va(DiagsLevel level, const SourceLocation *loc, const char 
*format_string, va_list ap) const
 {
-  va_list ap2;
-
-  if (DiagsLevel_IsTerminal(level)) {
-    va_copy(ap2, ap);
-  }
-
   print_va(nullptr, level, loc, format_string, ap);
 
   if (DiagsLevel_IsTerminal(level)) {
+    va_list ap2;
+
+    va_copy(ap2, ap);
     if (cleanup_func) {
       cleanup_func();
     }
@@ -479,9 +476,8 @@ Diags::error_va(DiagsLevel level, const SourceLocation 
*loc, const char *format_
     } else {
       ink_fatal_va(format_string, ap2);
     }
+    va_end(ap2);
   }
-
-  va_end(ap2);
 }
 
 /*

Reply via email to