Prevent double free of rerouted queries

When the routing of a queued query fails, the route_stored_query function
extract the SQL from and frees the already freed buffer.
This commit is contained in:
Markus Mäkelä 2018-02-14 12:36:00 +02:00
parent 5941f9d3b3
commit 4853fb0c64
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -485,18 +485,7 @@ static bool route_stored_query(RWSplitSession *rses)
if (!routeQuery((MXS_ROUTER*)rses->router, (MXS_ROUTER_SESSION*)rses, query_queue))
{
rval = false;
char* sql = modutil_get_SQL(query_queue);
if (sql)
{
MXS_ERROR("Routing query \"%s\" failed.", sql);
MXS_FREE(sql);
}
else
{
MXS_ERROR("Failed to route query.");
}
gwbuf_free(query_queue);
MXS_ERROR("Failed to route queued query.");
}
if (rses->query_queue == NULL)