diff --git a/include/maxscale/filter.hh b/include/maxscale/filter.hh index 278e39b0f..b39c63873 100644 --- a/include/maxscale/filter.hh +++ b/include/maxscale/filter.hh @@ -220,7 +220,7 @@ public: static MXS_FILTER_SESSION* newSession(MXS_FILTER* pInstance, MXS_SESSION* pSession) { FilterType* pFilter = static_cast(pInstance); - FilterSessionType* pFilterSession; + FilterSessionType* pFilterSession = NULL; MXS_EXCEPTION_GUARD(pFilterSession = pFilter->newSession(pSession)); diff --git a/query_classifier/qc_sqlite/qc_sqlite.cc b/query_classifier/qc_sqlite/qc_sqlite.cc index 4cfae297b..c4799a70c 100644 --- a/query_classifier/qc_sqlite/qc_sqlite.cc +++ b/query_classifier/qc_sqlite/qc_sqlite.cc @@ -4259,7 +4259,7 @@ static int32_t qc_sqlite_process_init(void) { if (this_unit.log_level != QC_LOG_NOTHING) { - const char* message; + const char* message = NULL; switch (this_unit.log_level) { diff --git a/server/core/buffer.cc b/server/core/buffer.cc index dfb9a865f..80d98a2f4 100644 --- a/server/core/buffer.cc +++ b/server/core/buffer.cc @@ -546,8 +546,8 @@ int gwbuf_compare(const GWBUF* lhs, const GWBUF* rhs) while ((rv == 0) && (i < llen)) { - uint8_t lc; - uint8_t rc; + uint8_t lc = 0; + uint8_t rc = 0; ss_debug(bool rv1 = ) gwbuf_get_byte(&lhs, &loffset, &lc); ss_debug(bool rv2 = ) gwbuf_get_byte(&rhs, &roffset, &rc); diff --git a/server/core/externcmd.cc b/server/core/externcmd.cc index a922dc6fd..6e1a998fd 100644 --- a/server/core/externcmd.cc +++ b/server/core/externcmd.cc @@ -37,7 +37,7 @@ int tokenize_arguments(char* argstr, char** argv) bool escaped = false; char *ptr, *start; char args[strlen(argstr) + 1]; - char qc; + char qc = 0; strcpy(args, argstr); start = args; diff --git a/server/core/log_manager.cc b/server/core/log_manager.cc index e5169f74c..a55e3196e 100644 --- a/server/core/log_manager.cc +++ b/server/core/log_manager.cc @@ -755,11 +755,11 @@ static int logmanager_write_log(int priority, size_t str_len, const char* str) { - logfile_t* lf; - char* wp; + logfile_t* lf = NULL; + char* wp = NULL; int err = 0; - blockbuf_t* bb; - blockbuf_t* bb_c; + blockbuf_t* bb = NULL; + blockbuf_t* bb_c = NULL; size_t timestamp_len; int i; diff --git a/server/core/modutil.cc b/server/core/modutil.cc index 8b5f7558a..978be9af3 100644 --- a/server/core/modutil.cc +++ b/server/core/modutil.cc @@ -762,7 +762,7 @@ char* strnchr_esc(char* ptr, char c, int len) char* p = (char*)ptr; char* start = p; bool quoted = false, escaped = false; - char qc; + char qc = 0; while (p < start + len) { @@ -808,7 +808,7 @@ char* strnchr_esc_mysql(char* ptr, char c, int len) char* p = (char*) ptr; char* start = p, *end = start + len; bool quoted = false, escaped = false, backtick = false, comment = false; - char qc; + char qc = 0; while (p < end) { diff --git a/server/core/server.cc b/server/core/server.cc index c5458bc24..570efa4f0 100644 --- a/server/core/server.cc +++ b/server/core/server.cc @@ -933,9 +933,9 @@ serverRowCallback(RESULTSET *set, void *data) { int *rowno = (int *)data; int i = 0; - char *stat, buf[20]; - RESULT_ROW *row; - SERVER *server; + char *stat = NULL, buf[20]; + RESULT_ROW *row = NULL; + SERVER *server = NULL; spinlock_acquire(&server_spin); server = allServers; diff --git a/server/core/service.cc b/server/core/service.cc index e897303db..264b39126 100644 --- a/server/core/service.cc +++ b/server/core/service.cc @@ -1237,8 +1237,8 @@ void service_set_retry_interval(SERVICE *service, int value) bool serviceSetFilters(SERVICE *service, char *filters) { - MXS_FILTER_DEF **flist; - char *ptr, *brkt; + MXS_FILTER_DEF **flist = NULL; + char *ptr = NULL, *brkt = NULL; int n = 0; bool rval = true; uint64_t capabilities = 0; diff --git a/server/core/utils.cc b/server/core/utils.cc index 5a4381746..6b96c5ff0 100644 --- a/server/core/utils.cc +++ b/server/core/utils.cc @@ -989,7 +989,7 @@ int open_network_socket(enum mxs_socket_type type, struct sockaddr_storage *addr { ss_dassert(type == MXS_SOCKET_NETWORK || type == MXS_SOCKET_LISTENER); struct addrinfo *ai = NULL, hint = {}; - int so, rc; + int so = 0, rc = 0; hint.ai_socktype = SOCK_STREAM; hint.ai_family = AF_UNSPEC; hint.ai_flags = AI_ALL; diff --git a/server/modules/filter/cache/rules.cc b/server/modules/filter/cache/rules.cc index 84f964c3c..35a4e3c6e 100644 --- a/server/modules/filter/cache/rules.cc +++ b/server/modules/filter/cache/rules.cc @@ -594,11 +594,11 @@ static CACHE_RULE *cache_rule_create_simple_user(cache_rule_attribute_t attribut const char *cvalue, uint32_t debug) { + CACHE_RULE *rule = NULL; + ss_dassert(attribute == CACHE_ATTRIBUTE_USER); ss_dassert((op == CACHE_OP_EQ) || (op == CACHE_OP_NEQ)); - CACHE_RULE *rule = NULL; - bool error = false; size_t len = strlen(cvalue); @@ -909,7 +909,7 @@ static CACHE_RULE *cache_rule_create_simple(cache_rule_attribute_t attribute, { ss_dassert((op == CACHE_OP_EQ) || (op == CACHE_OP_NEQ)); - CACHE_RULE *rule; + CACHE_RULE *rule = NULL; switch (attribute) { @@ -1524,7 +1524,7 @@ static bool cache_rule_matches_table_regexp(CACHE_RULE *self, bool matches = false; int n; - char **names; + char **names = NULL; bool fullnames; fullnames = true; @@ -1610,7 +1610,7 @@ static bool cache_rule_matches_table_simple(CACHE_RULE *self, const char *defaul } int n; - char **names; + char **names = NULL; names = qc_get_table_names((GWBUF*)query, &n, fullnames); diff --git a/server/modules/filter/dbfwfilter/dbfwfilter.c b/server/modules/filter/dbfwfilter/dbfwfilter.c index 9730d361a..6b89a69c1 100644 --- a/server/modules/filter/dbfwfilter/dbfwfilter.c +++ b/server/modules/filter/dbfwfilter/dbfwfilter.c @@ -1036,7 +1036,7 @@ char* get_regex_string(char** saved) { char *start = NULL, *ptr = *saved; bool escaped = false, quoted = false; - char delimiter; + char delimiter = 0; while (*ptr != '\0') { if (!escaped) diff --git a/server/modules/routing/debugcli/debugcmd.c b/server/modules/routing/debugcli/debugcmd.c index 06eaf2a02..fa6e6df2e 100644 --- a/server/modules/routing/debugcli/debugcmd.c +++ b/server/modules/routing/debugcli/debugcmd.c @@ -1760,7 +1760,7 @@ static struct static unsigned long convert_arg(char *arg, int arg_type) { - unsigned long rval; + unsigned long rval = 0; switch (arg_type) {