Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix crash at execute empty flush command
  • Loading branch information
ybbct authored and markus456 committed Jan 16, 2018
1 parent 847dd2c commit 2b65388
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion server/modules/routing/maxinfo/maxinfo_exec.c
Expand Up @@ -354,6 +354,13 @@ exec_flush(DCB *dcb, MAXINFO_TREE *tree)
int i;
char errmsg[120];

sprintf(errmsg, "Unsupported flush command '%s'", tree->value);
if(!tree)
{
maxinfo_send_error(dcb, 0, errmsg);
MXS_ERROR("%s", errmsg);
return;
}
for (i = 0; flush_commands[i].name; i++)
{
if (strcasecmp(flush_commands[i].name, tree->value) == 0)
Expand All @@ -366,7 +373,6 @@ exec_flush(DCB *dcb, MAXINFO_TREE *tree)
{
tree->value[80] = 0;
}
sprintf(errmsg, "Unsupported flush command '%s'", tree->value);
maxinfo_send_error(dcb, 0, errmsg);
MXS_ERROR("%s", errmsg);
}
Expand Down

0 comments on commit 2b65388

Please sign in to comment.