Fix some Coverity warnings.

This commit is contained in:
Robin Sommer 2016-08-02 11:38:07 -07:00
parent a273143e7d
commit 3adad5e19a
7 changed files with 27 additions and 8 deletions

View file

@ -1,4 +1,8 @@
2.4-737 | 2016-08-02 11:38:07 -0700
* Fix some Coverity warnings. (Robin Sommer)
2.4-735 | 2016-08-02 11:05:36 -0700 2.4-735 | 2016-08-02 11:05:36 -0700
* Added string slicing examples to documentation. (Moshe Kaplan) * Added string slicing examples to documentation. (Moshe Kaplan)

View file

@ -1 +1 @@
2.4-735 2.4-737

@ -1 +1 @@
Subproject commit 8dbf2470eda8f358ea225234e05b406da8e258f1 Subproject commit 3664242a218c21100d62917866d6b8cb0d6f0fa1

View file

@ -65,6 +65,20 @@ Tag& Tag::operator=(const Tag& other)
return *this; return *this;
} }
Tag& Tag::operator=(const Tag&& other)
{
if ( this != &other )
{
type = other.type;
subtype = other.subtype;
Unref(val);
val = other.val;
other.val = nullptr;
}
return *this;
}
EnumVal* Tag::AsEnumVal(EnumType* etype) const EnumVal* Tag::AsEnumVal(EnumType* etype) const
{ {
if ( ! val ) if ( ! val )

View file

@ -77,6 +77,11 @@ protected:
*/ */
Tag& operator=(const Tag& other); Tag& operator=(const Tag& other);
/**
* Move assignment operator.
*/
Tag& operator=(const Tag&& other);
/** /**
* Compares two tags for equality. * Compares two tags for equality.
*/ */

View file

@ -2278,7 +2278,7 @@ double TableVal::GetExpireTime()
Unref(timeout); Unref(timeout);
if ( interval >= 0 ) if ( interval >= 0 )
return timeout->AsInterval(); return interval;
expire_time = 0; expire_time = 0;
@ -2327,6 +2327,7 @@ double TableVal::CallExpireFunc(Val* idx)
if ( vf->Type()->Tag() != TYPE_FUNC ) if ( vf->Type()->Tag() != TYPE_FUNC )
{ {
Unref(vf); Unref(vf);
delete_vals(vl);
vf->Error("not a function"); vf->Error("not a function");
return 0; return 0;
} }

View file

@ -640,8 +640,6 @@ bool Manager::RemoveFilter(EnumVal* id, string name)
bool Manager::Write(EnumVal* id, RecordVal* columns) bool Manager::Write(EnumVal* id, RecordVal* columns)
{ {
bool error = false;
Stream* stream = FindStream(id); Stream* stream = FindStream(id);
if ( ! stream ) if ( ! stream )
return false; return false;
@ -850,9 +848,6 @@ bool Manager::Write(EnumVal* id, RecordVal* columns)
Unref(columns); Unref(columns);
if ( error )
RemoveDisabledWriters(stream);
return true; return true;
} }