Fix use of uninitialized variables
Building with optimization in debug mode revealed code that could in theory result in undefined behavior.
This commit is contained in:
parent
cc6665c732
commit
08a05d3ab9
@ -149,7 +149,7 @@ public:
|
||||
static MXS_ROUTER_SESSION* newSession(MXS_ROUTER* pInstance, MXS_SESSION* pSession)
|
||||
{
|
||||
RouterType* pRouter = static_cast<RouterType*>(pInstance);
|
||||
RouterSessionType* pRouter_session;
|
||||
RouterSessionType* pRouter_session = nullptr;
|
||||
|
||||
MXS_EXCEPTION_GUARD(pRouter_session = pRouter->newSession(pSession));
|
||||
|
||||
|
@ -123,7 +123,7 @@ int test(StorageFactory& factory, istream& in)
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int rv = EXIT_FAILURE;
|
||||
StorageFactory* pFactory;
|
||||
StorageFactory* pFactory = nullptr;
|
||||
if ((argc == 2) || (argc == 3))
|
||||
{
|
||||
char* libdir = MXS_STRDUP("../../../../../query_classifier/qc_sqlite/");
|
||||
|
@ -131,7 +131,9 @@ HINT* hint_parser(HINT_SESSION* session, GWBUF* request)
|
||||
int len, residual, state;
|
||||
int found, escape, quoted, squoted;
|
||||
HINT* rval = NULL;
|
||||
char* pname, * lvalue, * hintname = NULL;
|
||||
char* pname = nullptr;
|
||||
char* lvalue = nullptr;
|
||||
char* hintname = nullptr;
|
||||
GWBUF* buf;
|
||||
HINT_TOKEN* tok;
|
||||
HINT_MODE mode = HM_EXECUTE;
|
||||
|
@ -740,7 +740,7 @@ static void destroyInstance(MXS_FILTER* instance)
|
||||
|
||||
static void checkNamedPipe(TPM_INSTANCE* inst)
|
||||
{
|
||||
int ret;
|
||||
int ret = 0;
|
||||
char buffer[2];
|
||||
char buf[4096];
|
||||
char* named_pipe = inst->named_pipe;
|
||||
|
@ -487,7 +487,7 @@ private:
|
||||
{
|
||||
result_t rv = IS_SET_SQL_MODE;
|
||||
|
||||
char c;
|
||||
char c = *pSql_mode;
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -58,7 +58,8 @@ bool json_extract_field_names(const char* filename, std::vector<Column>& columns
|
||||
bool rval = false;
|
||||
json_error_t err;
|
||||
err.text[0] = '\0';
|
||||
json_t* obj, * arr;
|
||||
json_t* obj;
|
||||
json_t* arr = nullptr;
|
||||
|
||||
if ((obj = json_load_file(filename, 0, &err)) && (arr = json_object_get(obj, "fields")))
|
||||
{
|
||||
|
@ -3053,17 +3053,17 @@ void blr_handle_fake_gtid_list(ROUTER_INSTANCE* router,
|
||||
static bool blr_handle_missing_files(ROUTER_INSTANCE* router,
|
||||
char* new_file)
|
||||
{
|
||||
char* fptr;
|
||||
char* fptr = strrchr(new_file, '.');
|
||||
uint32_t new_fseqno;
|
||||
uint32_t curr_fseqno;
|
||||
char buf[BLRM_BINLOG_NAME_STR_LEN];
|
||||
char bigbuf[PATH_MAX + 1];
|
||||
|
||||
if (*new_file
|
||||
&& (fptr = strrchr(new_file, '.')) == NULL)
|
||||
if (fptr == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (router->fileroot)
|
||||
{
|
||||
MXS_FREE(router->fileroot);
|
||||
|
Loading…
x
Reference in New Issue
Block a user