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();
struct CachedStats {
unsigned long hosts;
unsigned long addresses;
unsigned long texts;
unsigned long total;
unsigned long hosts = 0;
unsigned long addresses = 0;
unsigned long texts = 0;
unsigned long total = 0;
};
struct Stats {
unsigned long requests; // These count only async requests.
unsigned long successful;
unsigned long failed;
unsigned long pending;
unsigned long requests = 0; // These count only async requests.
unsigned long successful = 0;
unsigned long failed = 0;
unsigned long pending = 0;
CachedStats cached;
};

View file

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

View file

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

View file

@ -45,7 +45,7 @@ public:
private:
StringValPtr msg;
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 {
@ -62,7 +62,7 @@ public:
private:
std::string mime;
int strength;
int strength = 0;
};
// Base class for enable/disable actions.

View file

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

View file

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

View file

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

View file

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