trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject git commit: Coverity fixes.
Date Tue, 30 Sep 2014 19:22:50 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/master f16c7615a -> b6753338f


Coverity fixes.


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

Branch: refs/heads/master
Commit: b6753338fa49c05f828e372545daa91a3d9ec733
Parents: f16c761
Author: Alan M. Carroll <amc@network-geographics.com>
Authored: Tue Sep 30 14:22:10 2014 -0500
Committer: Alan M. Carroll <amc@network-geographics.com>
Committed: Tue Sep 30 14:22:26 2014 -0500

----------------------------------------------------------------------
 lib/tsconfig/Errata.h          |   2 +-
 lib/tsconfig/NumericType.h     |   1 +
 lib/tsconfig/TsBuilder.cc      |   1 +
 lib/tsconfig/TsBuilder.h       | 108 ++++++++++++++++++------------------
 lib/tsconfig/TsConfigGrammar.c |   2 +-
 lib/tsconfig/TsConfigGrammar.y |   2 +-
 lib/tsconfig/TsConfigSyntax.c  |   2 +-
 lib/tsconfig/TsConfigSyntax.l  |   2 +-
 lib/tsconfig/TsConfigTypes.h   |   4 +-
 lib/tsconfig/TsErrataUtil.cc   |  38 +++++++++----
 lib/tsconfig/TsValue.h         |   4 +-
 11 files changed, 92 insertions(+), 74 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b6753338/lib/tsconfig/Errata.h
----------------------------------------------------------------------
diff --git a/lib/tsconfig/Errata.h b/lib/tsconfig/Errata.h
index 5c1d144..6f56a7d 100644
--- a/lib/tsconfig/Errata.h
+++ b/lib/tsconfig/Errata.h
@@ -905,7 +905,7 @@ inline bool RvBase::isOK() const { return _errata; }
 inline void RvBase::clear() { _errata.clear(); }
 inline void RvBase::doNotLog() { _errata.doNotLog(); }
 
-template < typename T > Rv<T>::Rv() { }
+template < typename T > Rv<T>::Rv() : _result()  { }
 template < typename T > Rv<T>::Rv(Result const& r) : _result(r) { }
 template < typename T > Rv<T>::Rv(Result const& r, Errata const& errata)
   : super(errata)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b6753338/lib/tsconfig/NumericType.h
----------------------------------------------------------------------
diff --git a/lib/tsconfig/NumericType.h b/lib/tsconfig/NumericType.h
index 6216187..8d6387b 100644
--- a/lib/tsconfig/NumericType.h
+++ b/lib/tsconfig/NumericType.h
@@ -149,6 +149,7 @@ public:
     self operator --(int);
 
 private:
+    // coverity[uninit_member]
     raw_type   _t;
 };
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b6753338/lib/tsconfig/TsBuilder.cc
----------------------------------------------------------------------
diff --git a/lib/tsconfig/TsBuilder.cc b/lib/tsconfig/TsBuilder.cc
index efba4bb..59e2b92 100644
--- a/lib/tsconfig/TsBuilder.cc
+++ b/lib/tsconfig/TsBuilder.cc
@@ -62,6 +62,7 @@ Builder::init() {
 
   // Zero everything first, just to be safe.
   memset(_dispatch, 0, sizeof(_dispatch));
+  memset(&_loc, 0, sizeof(_loc));
 
   for ( size_t i = 0 ; i < TS_CONFIG_N_EVENT_TYPES ; ++i) {
     _dispatch[i]._ptr = this;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b6753338/lib/tsconfig/TsBuilder.h
----------------------------------------------------------------------
diff --git a/lib/tsconfig/TsBuilder.h b/lib/tsconfig/TsBuilder.h
index 815e195..136841b 100644
--- a/lib/tsconfig/TsBuilder.h
+++ b/lib/tsconfig/TsBuilder.h
@@ -34,62 +34,62 @@ namespace ts { namespace config {
  */
 class Builder {
 public:
-    typedef Builder self;
-    struct Handler {
-        self* _ptr; ///< Pointer to Builder instance.
-        /// Pointer to method to invoke for this event.
-        void (self::*_method)(Token const& token);
-
-        /// Default constructor.
-        Handler();
-    };
+  typedef Builder self;
+  struct Handler {
+    self* _ptr; ///< Pointer to Builder instance.
+    /// Pointer to method to invoke for this event.
+    void (self::*_method)(Token const& token);
 
     /// Default constructor.
-    Builder();
-    /// Destructor.
-    virtual ~Builder() {}
-    /// Construct with existing configuration.
-    Builder(Configuration const& config);
-    /// Build the table.
-    /// @return The configuration or error status.
-    Rv<Configuration> build(
-        Buffer const& buffer ///< Input text.
-    );
-protected:
-    /// Dispatch table for parse events.
-    Handler _dispatch[TS_CONFIG_N_EVENT_TYPES];
-    /// Event handler table for the parser.
-    TsConfigHandlers _handlers;
-    /// Dispatch methods
-    virtual void groupOpen(Token const& token);
-    virtual void groupClose(Token const& token);
-    virtual void groupName(Token const& token);
-    virtual void listOpen(Token const& token);
-    virtual void listClose(Token const& token);
-    virtual void pathOpen(Token const& token);
-    virtual void pathTag(Token const& token);
-    virtual void pathIndex(Token const& token);
-    virtual void pathClose(Token const& token);
-    virtual void literalValue(Token const& token);
-    virtual void invalidToken(Token const& token);
-    /// Syntax error handler
-    virtual int syntaxError(char const* text);
-    /// Static method to handle parser event callbacks.
-    static void dispatch(void* data, Token* token);
-    /// Static method for syntax errors.
-    static int syntaxErrorDispatch(void* data, char const* text);
-
-    // Building state.
-    Configuration _config; ///< Configuration to update.
-    Errata _errata; ///< Error accumulator.
-    Value _v; ///< Current value.
-    Buffer _name; ///< Pending group name, if any.
-    Buffer _extent; ///< Accumulator for multi-token text.
-    Location _loc; ///< Cache for multi-token text.
-    Path _path; ///< Path accumulator
-
-    /// Initialization, called from constructors.
-    self& init();
+    Handler();
+  };
+
+  /// Default constructor.
+  Builder();
+  /// Destructor.
+  virtual ~Builder() {}
+  /// Construct with existing configuration.
+  Builder(Configuration const& config);
+  /// Build the table.
+  /// @return The configuration or error status.
+  Rv<Configuration> build(
+			  Buffer const& buffer ///< Input text.
+			  );
+ protected:
+  /// Dispatch table for parse events.
+  Handler _dispatch[TS_CONFIG_N_EVENT_TYPES];
+  /// Event handler table for the parser.
+  TsConfigHandlers _handlers;
+  /// Dispatch methods
+  virtual void groupOpen(Token const& token);
+  virtual void groupClose(Token const& token);
+  virtual void groupName(Token const& token);
+  virtual void listOpen(Token const& token);
+  virtual void listClose(Token const& token);
+  virtual void pathOpen(Token const& token);
+  virtual void pathTag(Token const& token);
+  virtual void pathIndex(Token const& token);
+  virtual void pathClose(Token const& token);
+  virtual void literalValue(Token const& token);
+  virtual void invalidToken(Token const& token);
+  /// Syntax error handler
+  virtual int syntaxError(char const* text);
+  /// Static method to handle parser event callbacks.
+  static void dispatch(void* data, Token* token);
+  /// Static method for syntax errors.
+  static int syntaxErrorDispatch(void* data, char const* text);
+
+  // Building state.
+  Configuration _config; ///< Configuration to update.
+  Errata _errata; ///< Error accumulator.
+  Value _v; ///< Current value.
+  Buffer _name; ///< Pending group name, if any.
+  Buffer _extent; ///< Accumulator for multi-token text.
+  Location _loc; ///< Cache for multi-token text.
+  Path _path; ///< Path accumulator
+
+  /// Initialization, called from constructors.
+  self& init();
 };
 
 inline Builder::Handler::Handler() : _ptr(0), _method(0) { }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b6753338/lib/tsconfig/TsConfigGrammar.c
----------------------------------------------------------------------
diff --git a/lib/tsconfig/TsConfigGrammar.c b/lib/tsconfig/TsConfigGrammar.c
index 6bcaaf8..c24f1a9 100644
--- a/lib/tsconfig/TsConfigGrammar.c
+++ b/lib/tsconfig/TsConfigGrammar.c
@@ -62,7 +62,7 @@
 /* Line 349 of yacc.c  */
 #line 26 "TsConfigGrammar.y"
 
-# if ! defined(__clang_analyzer__)
+# if ! (defined(__clang_analyzer__) || defined(__COVERITY__))
 # include "TsConfigTypes.h"
 # include <stdlib.h>
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b6753338/lib/tsconfig/TsConfigGrammar.y
----------------------------------------------------------------------
diff --git a/lib/tsconfig/TsConfigGrammar.y b/lib/tsconfig/TsConfigGrammar.y
index 63a0425..7dcfc87 100644
--- a/lib/tsconfig/TsConfigGrammar.y
+++ b/lib/tsconfig/TsConfigGrammar.y
@@ -24,7 +24,7 @@
 }
 
 %code top {
-# if ! defined(__clang_analyzer__)
+# if ! (defined(__clang_analyzer__) || defined(__COVERITY__))
 # include "TsConfigTypes.h"
 # include <stdlib.h>
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b6753338/lib/tsconfig/TsConfigSyntax.c
----------------------------------------------------------------------
diff --git a/lib/tsconfig/TsConfigSyntax.c b/lib/tsconfig/TsConfigSyntax.c
index ea363c3..17150a1 100644
--- a/lib/tsconfig/TsConfigSyntax.c
+++ b/lib/tsconfig/TsConfigSyntax.c
@@ -485,7 +485,7 @@ static yyconst flex_int16_t yy_chk[89] =
     limitations under the License.
  */
  
-# if ! defined(__clang_analyzer__)
+# if ! (defined(__clang_analyzer__) || defined(__COVERITY__))
 
 # include "TsConfigParseEvents.h"
 # include "TsConfigGrammar.h"

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b6753338/lib/tsconfig/TsConfigSyntax.l
----------------------------------------------------------------------
diff --git a/lib/tsconfig/TsConfigSyntax.l b/lib/tsconfig/TsConfigSyntax.l
index d7d6d7e..c8eba34 100644
--- a/lib/tsconfig/TsConfigSyntax.l
+++ b/lib/tsconfig/TsConfigSyntax.l
@@ -23,7 +23,7 @@
     limitations under the License.
  */
  
-# if ! defined(__clang_analyzer__)
+# if ! (defined(__clang_analyzer__) || defined(__COVERITY__))
 
 # include "TsConfigParseEvents.h"
 # include "TsConfigGrammar.h"

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b6753338/lib/tsconfig/TsConfigTypes.h
----------------------------------------------------------------------
diff --git a/lib/tsconfig/TsConfigTypes.h b/lib/tsconfig/TsConfigTypes.h
index b4399d0..6c64e04 100644
--- a/lib/tsconfig/TsConfigTypes.h
+++ b/lib/tsconfig/TsConfigTypes.h
@@ -40,8 +40,8 @@ namespace ts { namespace config {
     be the caller's responsibility?
  */
 struct Location {
-    int _col; ///< Column.
-    int _line; ///< Line.
+  int _col; ///< Column.
+  int _line; ///< Line.
 };
 
 /** A token from the source stream.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b6753338/lib/tsconfig/TsErrataUtil.cc
----------------------------------------------------------------------
diff --git a/lib/tsconfig/TsErrataUtil.cc b/lib/tsconfig/TsErrataUtil.cc
index 0cbec18..4d72b05 100644
--- a/lib/tsconfig/TsErrataUtil.cc
+++ b/lib/tsconfig/TsErrataUtil.cc
@@ -98,7 +98,9 @@ logf(
 ) {
   va_list rest;
   va_start(rest, format);
-  return vlogf(err, id, code, format, rest);
+  vlogf(err, id, code, format, rest);
+  va_end(rest);
+  return err;
 }
 
 Errata
@@ -106,21 +108,27 @@ logf(Errata::Code code, char const* format, ...) {
   Errata err;
   va_list rest;
   va_start(rest, format);
-  return vlogf(err, Errata::Id(0), code, format, rest);
+  vlogf(err, Errata::Id(0), code, format, rest);
+  va_end(rest);
+  return err;
 }
 
 Errata&
 logf(Errata& err, Errata::Code code, char const* format, ...) {
   va_list rest;
   va_start(rest, format);
-  return vlogf(err, Errata::Id(0), code, format, rest);
+  vlogf(err, Errata::Id(0), code, format, rest);
+  va_end(rest);
+  return err;
 }
 
 Errata&
 logf(RvBase& base, Errata::Code code, char const* format, ...) {
-    va_list rest;
-    va_start(rest, format);
-    return vlogf(base._errata, Errata::Id(0), code, format, rest);
+  va_list rest;
+  va_start(rest, format);
+  vlogf(base._errata, Errata::Id(0), code, format, rest);
+  va_end(rest);
+  return base._errata;
 }
 
 Errata
@@ -154,21 +162,29 @@ logf_errno(Errata::Code code, char const* format, ...) {
   Errata zret;
   va_list rest;
   va_start(rest, format);
-  return vlogf_errno(zret, 0, code, format, rest);
+  zret = vlogf_errno(zret, 0, code, format, rest);
+  va_end(rest);
+  return zret;
 }
 
 Errata
 logf_errno(Errata& errata, Errata::Code code, char const* format, ...) {
+  Errata zret;
   va_list rest;
   va_start(rest, format);
-  return vlogf_errno(errata, 0, code, format, rest);
+  zret = vlogf_errno(errata, 0, code, format, rest);
+  va_end(rest);
+  return zret;
 }
 
 Errata
 logf_errno(RvBase& rv, Errata::Code code, char const* format, ...) {
-    va_list rest;
-    va_start(rest, format);
-    return vlogf_errno(rv._errata, 0, code, format, rest);
+  Errata zret;
+  va_list rest;
+  va_start(rest, format);
+  zret = vlogf_errno(rv._errata, 0, code, format, rest);
+  va_end(rest);
+  return zret;
 }
 // ------------------------------------------------------
 }} // namespace ts::msg

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b6753338/lib/tsconfig/TsValue.h
----------------------------------------------------------------------
diff --git a/lib/tsconfig/TsValue.h b/lib/tsconfig/TsValue.h
index 3919ba3..aeee930 100644
--- a/lib/tsconfig/TsValue.h
+++ b/lib/tsconfig/TsValue.h
@@ -644,8 +644,8 @@ namespace detail {
   inline ValueItem const& ValueTable::operator [] (ValueIndex idx) const { return const_cast<self*>(this)->operator
[] (idx); }
   inline ValueTable& ValueTable::reset() { _ptr = 0; return *this; }
 
-  inline ValueItem::ValueItem() : _type(VoidValue) {}
-  inline ValueItem::ValueItem(ValueType type) : _type(type) {}
+  inline ValueItem::ValueItem() : _type(VoidValue), _local_index(0), _srcLine(0), _srcColumn(0)
{}
+  inline ValueItem::ValueItem(ValueType type) : _type(type), _local_index(0), _srcLine(0),
_srcColumn(0) {}
   inline ValueType ValueItem::getType() const { return _type; }
 }
 


Mime
View raw message