1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

A fix (Bug #5432: Is this a leak in mysql console client?)

This commit is contained in:
ram@gw.mysql.r18.ru
2004-09-07 14:24:47 +05:00
parent 92be15da12
commit 00830a11fc

View File

@@ -2220,7 +2220,9 @@ com_use(String *buffer __attribute__((unused)), char *line)
under our feet, for example if DROP DATABASE or RENAME DATABASE under our feet, for example if DROP DATABASE or RENAME DATABASE
(latter one not yet available by the time the comment was written) (latter one not yet available by the time the comment was written)
*/ */
current_db= 0; // Let's reset current_db, assume it's gone /* Let's reset current_db, assume it's gone */
my_free(current_db, MYF(MY_ALLOW_ZERO_PTR));
current_db= 0;
/* /*
We don't care about in case of an error below because current_db We don't care about in case of an error below because current_db
was just set to 0. was just set to 0.
@@ -2229,10 +2231,8 @@ com_use(String *buffer __attribute__((unused)), char *line)
(res= mysql_use_result(&mysql))) (res= mysql_use_result(&mysql)))
{ {
row= mysql_fetch_row(res); row= mysql_fetch_row(res);
if (row[0] && if (row[0])
(!current_db || cmp_database(current_db, row[0])))
{ {
my_free(current_db, MYF(MY_ALLOW_ZERO_PTR));
current_db= my_strdup(row[0], MYF(MY_WME)); current_db= my_strdup(row[0], MYF(MY_WME));
} }
(void) mysql_fetch_row(res); // Read eof (void) mysql_fetch_row(res); // Read eof