Commit ee511e55 authored by unknown's avatar unknown

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

parent 71ba3e55
...@@ -2220,7 +2220,9 @@ com_use(String *buffer __attribute__((unused)), char *line) ...@@ -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) ...@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment