minor bugfix to memory allocations

This commit is contained in:
Markus Makela
2014-09-01 10:11:04 +03:00
parent 58e8c05c8a
commit bc939501e9

View File

@ -1377,17 +1377,8 @@ static int routeQuery(
strcpy(hkey,dbname); strcpy(hkey,dbname);
strcat(hkey,"."); strcat(hkey,".");
strcat(hkey,tbl[0]); strcat(hkey,tbl[0]);
}
if(tsize > 0){
for(i = 0;i<tsize;i++){
free(tbl[i]);
} }
free(tbl);
}
}
if(QUERY_IS_TYPE(qtype, QUERY_TYPE_CREATE_TMP_TABLE)){ if(QUERY_IS_TYPE(qtype, QUERY_TYPE_CREATE_TMP_TABLE)){
@ -1433,6 +1424,7 @@ static int routeQuery(
LOGFILE_TRACE, LOGFILE_TRACE,
"Temporary table conflict in hashtable: %s",hkey))); "Temporary table conflict in hashtable: %s",hkey)));
} }
#if defined(SS_DEBUG) #if defined(SS_DEBUG)
bool retkey = hashtable_fetch( bool retkey = hashtable_fetch(
rses_prop_tmp->rses_prop_data.temp_tables, rses_prop_tmp->rses_prop_data.temp_tables,
@ -1443,17 +1435,31 @@ static int routeQuery(
"Temporary table added: %s",hkey))); "Temporary table added: %s",hkey)));
} }
#endif #endif
} }
/**Check if DROP TABLE... targets a temporary table*/ /**Check if DROP TABLE... targets a temporary table*/
if(QUERY_IS_TYPE(qtype, QUERY_TYPE_DROP_TABLE)){ if(QUERY_IS_TYPE(qtype, QUERY_TYPE_DROP_TABLE))
if(rses_prop_tmp && rses_prop_tmp->rses_prop_data.temp_tables){ {
if(rses_prop_tmp && rses_prop_tmp->rses_prop_data.temp_tables)
{
hashtable_delete(rses_prop_tmp->rses_prop_data.temp_tables, (void *)hkey); hashtable_delete(rses_prop_tmp->rses_prop_data.temp_tables, (void *)hkey);
} }
} }
free(hkey); free(hkey);
if(tsize > 0)
{
for(i = 0;i<tsize;i++)
{
free(tbl[i]);
}
free(tbl);
}
}
if (master_dcb == NULL) if (master_dcb == NULL)
{ {
succp = get_dcb(&master_dcb, router_cli_ses, BE_MASTER); succp = get_dcb(&master_dcb, router_cli_ses, BE_MASTER);