Fix uninitialized class member Coverity findings

This commit is contained in:
Tim Wojtulewicz 2025-07-11 21:38:57 -07:00
parent 923ffbf25a
commit 4c58fb26c4
8 changed files with 22 additions and 21 deletions

View file

@ -207,17 +207,17 @@ public:
bool Save(); bool Save();
struct CachedStats { struct CachedStats {
unsigned long hosts; unsigned long hosts = 0;
unsigned long addresses; unsigned long addresses = 0;
unsigned long texts; unsigned long texts = 0;
unsigned long total; unsigned long total = 0;
}; };
struct Stats { struct Stats {
unsigned long requests; // These count only async requests. unsigned long requests = 0; // These count only async requests.
unsigned long successful; unsigned long successful = 0;
unsigned long failed; unsigned long failed = 0;
unsigned long pending; unsigned long pending = 0;
CachedStats cached; CachedStats cached;
}; };

View file

@ -138,7 +138,7 @@ void* PrefixTable::Remove(const Val* value) {
} }
PrefixTable::iterator PrefixTable::InitIterator() { PrefixTable::iterator PrefixTable::InitIterator() {
iterator i; iterator i = {};
i.Xsp = i.Xstack; i.Xsp = i.Xstack;
i.Xrn = tree->head; i.Xrn = tree->head;
i.Xnode = nullptr; i.Xnode = nullptr;

View file

@ -21,10 +21,10 @@ namespace detail {
class PrefixTable { class PrefixTable {
private: private:
struct iterator { struct iterator {
patricia_node_t* Xstack[PATRICIA_MAXBITS + 1]; patricia_node_t* Xstack[PATRICIA_MAXBITS + 1] = {};
patricia_node_t** Xsp; patricia_node_t** Xsp = nullptr;
patricia_node_t* Xrn; patricia_node_t* Xrn = nullptr;
patricia_node_t* Xnode; patricia_node_t* Xnode = nullptr;
}; };
public: public:

View file

@ -45,7 +45,7 @@ public:
private: private:
StringValPtr msg; StringValPtr msg;
EventHandlerPtr handler; EventHandlerPtr handler;
bool want_end_of_match; // Whether handler accepts end_of_match parameter. bool want_end_of_match = false; // Whether handler accepts end_of_match parameter.
}; };
class RuleActionMIME : public RuleAction { class RuleActionMIME : public RuleAction {
@ -62,7 +62,7 @@ public:
private: private:
std::string mime; std::string mime;
int strength; int strength = 0;
}; };
// Base class for enable/disable actions. // Base class for enable/disable actions.

View file

@ -751,6 +751,7 @@ refine connection MySQL_Conn += {
deprecate_eof_ = false; deprecate_eof_ = false;
server_query_attrs_ = false; server_query_attrs_ = false;
client_query_attrs_ = false; client_query_attrs_ = false;
client_capabilities_ = 0;
query_attr_idx_ = 0; query_attr_idx_ = 0;
%} %}

View file

@ -103,9 +103,9 @@ public:
EventHandlerPtr event; EventHandlerPtr event;
RecordType* fields = nullptr; RecordType* fields = nullptr;
unsigned int num_fields; unsigned int num_fields = 0;
bool want_record; bool want_record = false;
EventStream(); EventStream();
~EventStream() override; ~EventStream() override;
}; };

View file

@ -112,8 +112,8 @@ private:
TableValPtr tv = nullptr; TableValPtr tv = nullptr;
std::vector<ZVal*> loop_vars; std::vector<ZVal*> loop_vars;
const std::vector<TypePtr>* loop_var_types; const std::vector<TypePtr>* loop_var_types = nullptr;
const std::vector<bool>* lvt_is_managed; const std::vector<bool>* lvt_is_managed = nullptr;
TypePtr value_var_type; TypePtr value_var_type;
std::optional<DictIterator<TableEntryVal>> tbl_iter; std::optional<DictIterator<TableEntryVal>> tbl_iter;

View file

@ -74,8 +74,8 @@ private:
std::string full_path; std::string full_path;
std::string table_name; std::string table_name;
std::chrono::milliseconds pragma_timeout; std::chrono::milliseconds pragma_timeout = {};
std::chrono::milliseconds pragma_wait_on_busy; std::chrono::milliseconds pragma_wait_on_busy = {};
telemetry::GaugePtr page_count_metric; telemetry::GaugePtr page_count_metric;
telemetry::GaugePtr file_size_metric; telemetry::GaugePtr file_size_metric;