diff --git a/src/FlowSrc.cc b/src/FlowSrc.cc index 7a79e9063b..32aa4c4e3a 100644 --- a/src/FlowSrc.cc +++ b/src/FlowSrc.cc @@ -14,8 +14,11 @@ FlowSrc::FlowSrc() { // TODO: v9. + selectable_fd = -1; idle = false; data = 0; + pdu_len = -1; + exporter_ip = 0; current_timestamp = next_timestamp = 0.0; netflow_analyzer = new binpac::NetFlow::NetFlow_Analyzer(); } diff --git a/src/PacketSort.cc b/src/PacketSort.cc index a7e2b04572..429d8e2720 100644 --- a/src/PacketSort.cc +++ b/src/PacketSort.cc @@ -17,6 +17,9 @@ PacketSortElement::PacketSortElement(PktSrc* arg_src, is_tcp = 0; ip_hdr = 0; + tcp_flags = 0; + endp = 0; + payload_length = 0; key = 0; // Now check if it is a "parsable" TCP packet. diff --git a/src/PersistenceSerializer.h b/src/PersistenceSerializer.h index dcd712bf84..7274e60569 100644 --- a/src/PersistenceSerializer.h +++ b/src/PersistenceSerializer.h @@ -113,7 +113,8 @@ protected: conns = 0; conn_cookie = 0; peer = SOURCE_LOCAL; - }; + filename = 0; + } Type type; SerialInfo info; diff --git a/src/PktSrc.cc b/src/PktSrc.cc index f318405920..9d6bce6fe9 100644 --- a/src/PktSrc.cc +++ b/src/PktSrc.cc @@ -648,6 +648,7 @@ PktDumper::PktDumper(const char* arg_filename, bool arg_append) is_error = false; append = arg_append; dumper = 0; + open_time = 0.0; // We need a pcap_t with a reasonable link-layer type. We try to get it // from the packet sources. If not available, we fall back to Ethernet. diff --git a/src/PolicyFile.cc b/src/PolicyFile.cc index 7ed0b02d75..5d0082c6a9 100644 --- a/src/PolicyFile.cc +++ b/src/PolicyFile.cc @@ -86,6 +86,7 @@ bool LoadPolicyFileText(const char* policy_filename) char buf[256]; strerror_r(errno, buf, sizeof(buf)); reporter->Error("fstat failed on %s: %s", policy_filename, buf); + fclose(f); return false; } diff --git a/src/RemoteSerializer.cc b/src/RemoteSerializer.cc index 7d9c6163a0..c8cf03667b 100644 --- a/src/RemoteSerializer.cc +++ b/src/RemoteSerializer.cc @@ -3321,6 +3321,9 @@ SocketComm::SocketComm() id_counter = 10000; parent_peer = 0; parent_msgstate = TYPE; + parent_id = RemoteSerializer::PEER_NONE; + parent_msgtype = 0; + parent_args = 0; shutting_conns_down = false; terminating = false; killing = false; diff --git a/src/analyzer/protocol/netflow/netflow-analyzer.pac b/src/analyzer/protocol/netflow/netflow-analyzer.pac index 666de076c8..439215dbc1 100644 --- a/src/analyzer/protocol/netflow/netflow-analyzer.pac +++ b/src/analyzer/protocol/netflow/netflow-analyzer.pac @@ -31,8 +31,11 @@ flow NetFlow_Flow { internal_type("nf_v5_record")->AsRecordType(); nfheader_id_type = internal_type("nfheader_id")->AsRecordType(); - pdu_id = 0; identifier = NULL; + exporter_ip = 0; + uptime = 0; + export_time = 0; + pdu_id = 0; %} # %cleanup does not only put the cleanup code into the destructor, diff --git a/src/input/Manager.cc b/src/input/Manager.cc index a05eb59e99..ee1e1ef522 100644 --- a/src/input/Manager.cc +++ b/src/input/Manager.cc @@ -1518,7 +1518,6 @@ int Manager::PutTable(Stream* i, const Value* const *vals) EnumVal* ev; int startpos = 0; Val* predidx = ValueToRecordVal(vals, stream->itype, &startpos); - Ref(valval); if ( updated ) ev = new EnumVal(BifEnum::Input::EVENT_CHANGED, @@ -1529,7 +1528,10 @@ int Manager::PutTable(Stream* i, const Value* const *vals) bool result; if ( stream->num_val_fields > 0 ) // we have values + { + Ref(valval); result = CallPred(stream->pred, 3, ev, predidx, valval); + } else // no values result = CallPred(stream->pred, 2, ev, predidx); diff --git a/src/input/readers/Raw.cc b/src/input/readers/Raw.cc index 1c02339748..d795430ba3 100644 --- a/src/input/readers/Raw.cc +++ b/src/input/readers/Raw.cc @@ -289,7 +289,8 @@ bool Raw::OpenInput() return false; } - fcntl(fileno(file), F_SETFD, FD_CLOEXEC); + if ( ! SetFDFlags(fileno(file), F_SETFD, FD_CLOEXEC) ) + Warning(Fmt("Init: cannot set close-on-exec for %s", fname.c_str())); } return true; diff --git a/src/util.cc b/src/util.cc index bcc9b0bb27..dd232a83fa 100644 --- a/src/util.cc +++ b/src/util.cc @@ -652,16 +652,8 @@ void hmac_md5(size_t size, const unsigned char* bytes, unsigned char digest[16]) static bool read_random_seeds(const char* read_file, uint32* seed, uint32* buf, int bufsiz) { - struct stat st; FILE* f = 0; - if ( stat(read_file, &st) < 0 ) - { - reporter->Warning("Seed file '%s' does not exist: %s", - read_file, strerror(errno)); - return false; - } - if ( ! (f = fopen(read_file, "r")) ) { reporter->Warning("Could not open seed file '%s': %s",