Fixing a few Coverity warnings.

This commit is contained in:
Robin Sommer 2016-05-23 08:25:11 -07:00
parent 85213e6b55
commit 50945a6359
6 changed files with 8 additions and 4 deletions

View file

@ -21,7 +21,7 @@ public:
void MinimizeTime() { time = -HUGE_VAL; }
protected:
PQ_Element() { }
PQ_Element() { time = 0; offset = -1; }
double time;
int offset;
};

View file

@ -2401,7 +2401,7 @@ bool TableVal::DoSerialize(SerialInfo* info) const
}
// Serialize index.
if ( ! state->did_index )
if ( k && ! state->did_index )
{
// Indices are rather small, so we disable suspension
// here again.

View file

@ -12,7 +12,8 @@ using namespace analyzer::conn_size;
ConnSize_Analyzer::ConnSize_Analyzer(Connection* c)
: Analyzer("CONNSIZE", c),
orig_bytes(), resp_bytes(), orig_pkts(), resp_pkts()
orig_bytes(), resp_bytes(), orig_pkts(), resp_pkts(),
orig_bytes_thresh(), resp_bytes_thresh(), orig_pkts_thresh(), resp_pkts_thresh()
{
}

View file

@ -14,6 +14,7 @@ Entropy::Entropy(RecordVal* args, File* file)
{
//entropy->Init();
entropy = new EntropyVal;
fed = false;
}
Entropy::~Entropy()

View file

@ -1204,7 +1204,7 @@ int Manager::SendEntryTable(Stream* i, const Value* const *vals)
ih->idxkey = new HashKey(k->Key(), k->Size(), k->Hash());
ih->valhash = valhash;
if ( stream->event && updated )
if ( oldval && stream->event && updated )
Ref(oldval); // otherwise it is no longer accessible after the assignment
stream->tab->Assign(idxval, k, valval);

View file

@ -646,6 +646,8 @@ patricia_search_all (patricia_tree_t *patricia, prefix_t *prefix, patricia_node_
// ok, now we have an upper bound of how much we can return. Let's just alloc that...
patricia_node_t **outlist = calloc(cnt, sizeof(patricia_node_t*));
if (outlist == NULL)
out_of_memory("patrica/patricia_search_all: unable to allocate memory");
while (--cnt >= 0) {
node = stack[cnt];