Removed unnecessary memory allocation.
This commit is contained in:
@ -47,6 +47,7 @@
|
|||||||
#define MYSQL_PASSWORD_LEN 41
|
#define MYSQL_PASSWORD_LEN 41
|
||||||
#define MYSQL_HOST_MAXLEN 60
|
#define MYSQL_HOST_MAXLEN 60
|
||||||
#define MYSQL_DATABASE_MAXLEN 128
|
#define MYSQL_DATABASE_MAXLEN 128
|
||||||
|
#define MYSQL_TABLE_MAXLEN 64
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MySQL user and host data structure
|
* MySQL user and host data structure
|
||||||
|
|||||||
@ -1636,7 +1636,8 @@ static skygw_query_type_t is_read_tmp_table(
|
|||||||
bool target_tmp_table = false;
|
bool target_tmp_table = false;
|
||||||
int tsize = 0, klen = 0,i;
|
int tsize = 0, klen = 0,i;
|
||||||
char** tbl = NULL;
|
char** tbl = NULL;
|
||||||
char *hkey,*dbname;
|
char *dbname;
|
||||||
|
char hkey[MYSQL_DATABASE_MAXLEN+MYSQL_TABLE_MAXLEN+2];
|
||||||
MYSQL_session* data;
|
MYSQL_session* data;
|
||||||
|
|
||||||
DCB* master_dcb = NULL;
|
DCB* master_dcb = NULL;
|
||||||
@ -1664,12 +1665,7 @@ static skygw_query_type_t is_read_tmp_table(
|
|||||||
/** Query targets at least one table */
|
/** Query targets at least one table */
|
||||||
for(i = 0; i<tsize && !target_tmp_table && tbl[i]; i++)
|
for(i = 0; i<tsize && !target_tmp_table && tbl[i]; i++)
|
||||||
{
|
{
|
||||||
klen = strlen(dbname) + strlen(tbl[i]) + 2;
|
sprintf(hkey,"%s.%s",dbname,tbl[i]);
|
||||||
hkey = calloc(klen,sizeof(char));
|
|
||||||
strcpy(hkey,dbname);
|
|
||||||
strcat(hkey,".");
|
|
||||||
strcat(hkey,tbl[i]);
|
|
||||||
|
|
||||||
if (rses_prop_tmp &&
|
if (rses_prop_tmp &&
|
||||||
rses_prop_tmp->rses_prop_data.temp_tables)
|
rses_prop_tmp->rses_prop_data.temp_tables)
|
||||||
{
|
{
|
||||||
@ -1684,8 +1680,6 @@ static skygw_query_type_t is_read_tmp_table(
|
|||||||
"Query targets a temporary table: %s",hkey)));
|
"Query targets a temporary table: %s",hkey)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free(hkey);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user