cache: Remove default db only is use db succeeds

This commit is contained in:
Johan Wikman
2016-09-26 10:11:08 +03:00
parent fd3bbf24c8
commit 20b57b1577

View File

@ -444,11 +444,12 @@ static int routeQuery(FILTER *instance, void *sdata, GWBUF *data)
} }
else else
{ {
// Memory allocation failed. Let's remove the default database to // Memory allocation failed. We need to remove the default database to
// prevent incorrect cache entries, since we won't know what the // prevent incorrect cache entries, since we won't know what the
// default db will be. // default db is. But we only need to do that if "USE <db>" really
MXS_FREE(csdata->default_db); // succeeds. The right thing will happen by itself in
csdata->default_db = NULL; // handle_expecting_use_response(); if OK is returned, default_db will
// become NULL, if ERR, default_db will not be changed.
} }
} }
break; break;