This commit is contained in:
VilhoRaatikka
2014-11-05 14:43:22 +02:00
6 changed files with 32 additions and 15 deletions

View File

@ -1049,15 +1049,16 @@ char** skygw_get_table_names(GWBUF* querybuf,int* tblsize, bool fullnames)
TABLE_LIST* tbl; TABLE_LIST* tbl;
int i = 0, int i = 0,
currtblsz = 0; currtblsz = 0;
char **tables, char **tables = NULL,
**tmp; **tmp = NULL;
if((lex = get_lex(querybuf)) == NULL) if( (lex = get_lex(querybuf)) == NULL ||
{ lex->current_select == NULL )
{
goto retblock; goto retblock;
} }
lex->current_select = lex->all_selects_list; lex->current_select = lex->all_selects_list;
while(lex->current_select){ while(lex->current_select){

View File

@ -171,10 +171,11 @@ int i;
if ((my_instance = calloc(1, sizeof(QLA_INSTANCE))) != NULL) if ((my_instance = calloc(1, sizeof(QLA_INSTANCE))) != NULL)
{ {
if (options) if (options){
my_instance->filebase = strdup(options[0]); my_instance->filebase = strdup(options[0]);
else }else{
my_instance->filebase = strdup("qla"); my_instance->filebase = strdup("qla");
}
my_instance->source = NULL; my_instance->source = NULL;
my_instance->userName = NULL; my_instance->userName = NULL;
my_instance->match = NULL; my_instance->match = NULL;
@ -197,8 +198,10 @@ int i;
my_instance->userName = strdup(params[i]->value); my_instance->userName = strdup(params[i]->value);
else if (!strcmp(params[i]->name, "filebase")) else if (!strcmp(params[i]->name, "filebase"))
{ {
if (my_instance->filebase) if (my_instance->filebase){
free(my_instance->filebase); free(my_instance->filebase);
my_instance->filebase = NULL;
}
my_instance->source = strdup(params[i]->value); my_instance->source = strdup(params[i]->value);
} }
else if (!filter_standard_parameter(params[i]->name)) else if (!filter_standard_parameter(params[i]->name))
@ -220,7 +223,9 @@ int i;
my_instance->match))); my_instance->match)));
free(my_instance->match); free(my_instance->match);
free(my_instance->source); free(my_instance->source);
free(my_instance->filebase); if(my_instance->filebase){
free(my_instance->filebase);
}
free(my_instance); free(my_instance);
return NULL; return NULL;
} }
@ -236,7 +241,9 @@ int i;
regfree(&my_instance->re); regfree(&my_instance->re);
free(my_instance->match); free(my_instance->match);
free(my_instance->source); free(my_instance->source);
free(my_instance->filebase); if(my_instance->filebase){
free(my_instance->filebase);
}
free(my_instance); free(my_instance);
return NULL; return NULL;
} }

View File

@ -391,7 +391,7 @@ routeQuery(FILTER *instance, void *session, GWBUF *queue)
TEE_INSTANCE *my_instance = (TEE_INSTANCE *)instance; TEE_INSTANCE *my_instance = (TEE_INSTANCE *)instance;
TEE_SESSION *my_session = (TEE_SESSION *)session; TEE_SESSION *my_session = (TEE_SESSION *)session;
char *ptr; char *ptr;
int length, rval, residual; int length, rval, residual = 0;
GWBUF *clone = NULL; GWBUF *clone = NULL;
if (my_session->residual) if (my_session->residual)

View File

@ -270,6 +270,7 @@ int n_connect = 0;
if (client_dcb == NULL) if (client_dcb == NULL)
{ {
close(so);
return n_connect; return n_connect;
} }
client_dcb->fd = so; client_dcb->fd = so;

View File

@ -298,6 +298,7 @@ int n_connect = 0;
if (client_dcb == NULL) if (client_dcb == NULL)
{ {
close(so);
return n_connect; return n_connect;
} }
client_dcb->fd = so; client_dcb->fd = so;

View File

@ -1520,14 +1520,21 @@ skygw_query_type_t is_read_tmp_table(
} }
free(hkey); free(hkey);
free(tbl[i]);
} }
free(tbl);
} }
} }
return qtype; if(tsize > 0)
{
for(i = 0; i<tsize;i++)
{
free(tbl[i]);
}
free(tbl);
}
return qtype;
} }
/** /**