Commit cca1e62b authored by reggie@mdk10.(none)'s avatar reggie@mdk10.(none)

Bug #9175 seg fault on 'mysqldump --single-transaction --tab mysql nonexistent'

mysqldump.c:
  Fixed get_actual_table_name so that it calls mysql_free_result in all cases that a non-NULl result is returned
parent 04b3c901
...@@ -2120,6 +2120,7 @@ static int get_actual_table_name(const char *old_table_name, ...@@ -2120,6 +2120,7 @@ static int get_actual_table_name(const char *old_table_name,
char *new_table_name, char *new_table_name,
int buf_size) int buf_size)
{ {
int retval;
MYSQL_RES *tableRes; MYSQL_RES *tableRes;
MYSQL_ROW row; MYSQL_ROW row;
char query[50 + 2*NAME_LEN]; char query[50 + 2*NAME_LEN];
...@@ -2137,6 +2138,7 @@ static int get_actual_table_name(const char *old_table_name, ...@@ -2137,6 +2138,7 @@ static int get_actual_table_name(const char *old_table_name,
} }
tableRes= mysql_store_result( sock ); tableRes= mysql_store_result( sock );
retval = 1;
if (tableRes != NULL) if (tableRes != NULL)
{ {
my_ulonglong numRows = mysql_num_rows(tableRes); my_ulonglong numRows = mysql_num_rows(tableRes);
...@@ -2144,12 +2146,11 @@ static int get_actual_table_name(const char *old_table_name, ...@@ -2144,12 +2146,11 @@ static int get_actual_table_name(const char *old_table_name,
{ {
row= mysql_fetch_row( tableRes ); row= mysql_fetch_row( tableRes );
strmake(new_table_name, row[0], buf_size-1); strmake(new_table_name, row[0], buf_size-1);
return 0; retval = 0;
} }
mysql_free_result(tableRes); mysql_free_result(tableRes);
return 1;
} }
return 1; return retval;
} }
......
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