diff --git a/query_classifier/query_classifier.cc b/query_classifier/query_classifier.cc index 5773c3685..be25f239e 100644 --- a/query_classifier/query_classifier.cc +++ b/query_classifier/query_classifier.cc @@ -1088,30 +1088,31 @@ char** skygw_get_table_names(GWBUF* querybuf,int* tblsize, bool fullnames) } } + if(tmp != NULL){ + char *catnm = NULL; - char *catnm = NULL; - - if(fullnames) - { - if(tbl->db && strcmp(tbl->db,"skygw_virtual") != 0) - { - catnm = (char*)calloc(strlen(tbl->db) + strlen(tbl->table_name) + 2,sizeof(char)); - strcpy(catnm,tbl->db); - strcat(catnm,"."); - strcat(catnm,tbl->table_name); - } - } + if(fullnames) + { + if(tbl->db && strcmp(tbl->db,"skygw_virtual") != 0) + { + catnm = (char*)calloc(strlen(tbl->db) + strlen(tbl->table_name) + 2,sizeof(char)); + strcpy(catnm,tbl->db); + strcat(catnm,"."); + strcat(catnm,tbl->table_name); + } + } - if(catnm) - { - tables[i++] = catnm; - } - else - { - tables[i++] = strdup(tbl->table_name); - } + if(catnm) + { + tables[i++] = catnm; + } + else + { + tables[i++] = strdup(tbl->table_name); + } - tbl=tbl->next_local; + tbl=tbl->next_local; + } } lex->current_select = lex->current_select->next_select_in_list(); } diff --git a/query_classifier/test/canonical_tests/canonizer.c b/query_classifier/test/canonical_tests/canonizer.c index 1de287015..7983c9041 100644 --- a/query_classifier/test/canonical_tests/canonizer.c +++ b/query_classifier/test/canonical_tests/canonizer.c @@ -57,7 +57,7 @@ int main(int argc, char** argv) { fgets(readbuff,4092,infile); psize = strlen(readbuff); - if(psize < 0 || > 4092){ + if(psize < 0 || psize > 4092){ continue; } qbuff = gwbuf_alloc(psize + 7); diff --git a/server/core/config.c b/server/core/config.c index 1532909d0..f0da45a26 100644 --- a/server/core/config.c +++ b/server/core/config.c @@ -1359,7 +1359,7 @@ SERVER *server; serviceSetUser(obj->element, user, auth); - if (enable_root_user && service) + if (enable_root_user) serviceEnableRootUser(service, atoi(enable_root_user)); if (allow_localhost_match_wildcard_host && service) diff --git a/server/modules/filter/test/harness_common.c b/server/modules/filter/test/harness_common.c index a345a5e09..3c42bfdde 100644 --- a/server/modules/filter/test/harness_common.c +++ b/server/modules/filter/test/harness_common.c @@ -137,8 +137,8 @@ FILTER_PARAMETER** read_params(int* paramc) do_read = 0; } } - FILTER_PARAMETER** params; - if((params = malloc(sizeof(FILTER_PARAMETER*)*(pc+1)))!=NULL){ + FILTER_PARAMETER** params = NULL; + if((params = malloc(sizeof(FILTER_PARAMETER*)*(pc+1))) != NULL){ for(i = 0;irses_prop_data.temp_tables) - { - if (hashtable_delete(rses_prop_tmp->rses_prop_data.temp_tables, - (void *)hkey)) - { - LOGIF(LT, (skygw_log_write(LOGFILE_TRACE, - "Temporary table dropped: %s",hkey))); - } - } - free(tbl[i]); - free(hkey); - } - if(tbl != NULL){ - free(tbl); - } + if (rses_prop_tmp && + rses_prop_tmp->rses_prop_data.temp_tables) + { + if (hashtable_delete(rses_prop_tmp->rses_prop_data.temp_tables, + (void *)hkey)) + { + LOGIF(LT, (skygw_log_write(LOGFILE_TRACE, + "Temporary table dropped: %s",hkey))); + } + } + free(tbl[i]); + free(hkey); + } + + free(tbl); + } } } @@ -1495,7 +1495,7 @@ skygw_query_type_t is_read_tmp_table( { tbl = skygw_get_table_names(querybuf,&tsize,false); - if (tsize > 0) + if (tbl != NULL && tsize > 0) { /** Query targets at least one table */ for(i = 0; i