diff --git a/src/ChunkedIO.cc b/src/ChunkedIO.cc index 2c766c7eb1..7e666ee198 100644 --- a/src/ChunkedIO.cc +++ b/src/ChunkedIO.cc @@ -1074,9 +1074,8 @@ bool ChunkedIOSSL::Read(Chunk** chunk, bool mayblock) read_state = LEN; #ifdef DEBUG - if ( *chunk ) - DBG_LOG(DBG_CHUNKEDIO, "ssl read of size %d [%s]", - (*chunk)->len, fmt_bytes((*chunk)->data, 20)); + DBG_LOG(DBG_CHUNKEDIO, "ssl read of size %d [%s]", + (*chunk)->len, fmt_bytes((*chunk)->data, 20)); #endif return true; diff --git a/src/Desc.cc b/src/Desc.cc index 9d94321427..40b6fcc3d1 100644 --- a/src/Desc.cc +++ b/src/Desc.cc @@ -23,11 +23,7 @@ ODesc::ODesc(desc_type t, BroFile* arg_f) size = DEFAULT_SIZE; base = safe_malloc(size); ((char*) base)[0] = '\0'; - offset = 0; - - if ( ! base ) - OutOfMemory(); } else { @@ -337,16 +333,9 @@ void ODesc::Grow(unsigned int n) { size *= 2; base = safe_realloc(base, size); - if ( ! base ) - OutOfMemory(); } } -void ODesc::OutOfMemory() - { - reporter->InternalError("out of memory"); - } - void ODesc::Clear() { offset = 0; diff --git a/src/Desc.h b/src/Desc.h index 9fa41381ed..c16c00cf13 100644 --- a/src/Desc.h +++ b/src/Desc.h @@ -149,8 +149,6 @@ protected: // Make buffer big enough for n bytes beyond bufp. void Grow(unsigned int n); - void OutOfMemory(); - /** * Returns the location of the first place in the bytes to be hex-escaped. * diff --git a/src/RemoteSerializer.cc b/src/RemoteSerializer.cc index fa5a29386c..bc006b4b1f 100644 --- a/src/RemoteSerializer.cc +++ b/src/RemoteSerializer.cc @@ -2925,8 +2925,7 @@ void RemoteSerializer::GotID(ID* id, Val* val) const char* desc = val->AsString()->CheckString(); current_peer->val->Assign(4, new StringVal(desc)); - Log(LogInfo, fmt("peer_description is %s", - (desc && *desc) ? desc : "not set"), + Log(LogInfo, fmt("peer_description is %s", *desc ? desc : "not set"), current_peer); Unref(id); diff --git a/src/Serializer.cc b/src/Serializer.cc index e6bf6429d7..f7544765fa 100644 --- a/src/Serializer.cc +++ b/src/Serializer.cc @@ -378,7 +378,7 @@ bool Serializer::UnserializeCall(UnserialInfo* info) ignore = true; } - if ( info->print && types && ! ignore ) + if ( info->print && ! ignore ) v->Describe(&d); } diff --git a/src/analyzer/protocol/pia/PIA.cc b/src/analyzer/protocol/pia/PIA.cc index cc1dd7ea0e..81c7251820 100644 --- a/src/analyzer/protocol/pia/PIA.cc +++ b/src/analyzer/protocol/pia/PIA.cc @@ -147,10 +147,12 @@ void PIA_UDP::ActivateAnalyzer(analyzer::Tag tag, const Rule* rule) return; analyzer::Analyzer* a = Parent()->AddChildAnalyzer(tag); - a->SetSignature(rule); - if ( a ) - ReplayPacketBuffer(a); + if ( ! a ) + return; + + a->SetSignature(rule); + ReplayPacketBuffer(a); } void PIA_UDP::DeactivateAnalyzer(analyzer::Tag tag) diff --git a/src/input/readers/Raw.cc b/src/input/readers/Raw.cc index 2c2b319793..64c29d632c 100644 --- a/src/input/readers/Raw.cc +++ b/src/input/readers/Raw.cc @@ -291,6 +291,12 @@ bool Raw::CloseInput() bool Raw::DoInit(const ReaderInfo& info, int num_fields, const Field* const* fields) { + if ( ! info.source || strlen(info.source) == 0 ) + { + Error("No source path provided"); + return false; + } + fname = info.source; mtime = 0; execute = false; @@ -298,7 +304,6 @@ bool Raw::DoInit(const ReaderInfo& info, int num_fields, const Field* const* fie int want_fields = 1; bool result; - // do Initialization string source = string(info.source); char last = info.source[source.length() - 1]; if ( last == '|' ) @@ -307,12 +312,6 @@ bool Raw::DoInit(const ReaderInfo& info, int num_fields, const Field* const* fie fname = source.substr(0, fname.length() - 1); } - if ( ! info.source || strlen(info.source) == 0 ) - { - Error("No source path provided"); - return false; - } - map::const_iterator it = info.config.find("stdin"); // data that is sent to the child process if ( it != info.config.end() ) { diff --git a/src/input/readers/SQLite.cc b/src/input/readers/SQLite.cc index eec3698540..345dfdc226 100644 --- a/src/input/readers/SQLite.cc +++ b/src/input/readers/SQLite.cc @@ -187,11 +187,14 @@ Value* SQLite::EntryToVal(sqlite3_stmt *st, const threading::Field *field, int p if ( subpos != -1 ) { const char *text = (const char*) sqlite3_column_text(st, subpos); - string s(text, sqlite3_column_bytes(st, subpos)); + if ( text == 0 ) Error("Port protocol definition did not contain text"); else + { + string s(text, sqlite3_column_bytes(st, subpos)); val->val.port_val.proto = io->ParseProto(s); + } } break; }