query_classifier.cc: cleaned up and simplified skygw_get_canonical

skygw_util.cc:fixed memory allocation issue where terminating byte wasn't counted. Added some error checks.
This commit is contained in:
VilhoRaatikka
2014-08-21 23:08:21 +03:00
parent 8d1eae6fde
commit 3a5b8ef64c
2 changed files with 27 additions and 25 deletions

View File

@ -860,7 +860,6 @@ char* skygw_get_canonical(
THD* thd;
LEX* lex;
bool found = false;
char* newstr = NULL;
Item* item;
char* querystr;
@ -898,26 +897,11 @@ char* skygw_get_canonical(
itype == Item::VARBIN_ITEM ||
itype == Item::NULL_ITEM))
{
if (!found)
{
newstr = replace_literal(querystr, item->name, "?");
if (newstr != NULL)
{
free(querystr);
found = true;
}
}
else
{
char* prevstr = newstr;
newstr = replace_literal(prevstr, item->name, "?");
free(prevstr);
}
querystr = replace_literal(querystr, item->name, "?");
}
} /*< for */
retblock:
return newstr;
return querystr;
}