Commit 93398c30 authored by Vasil Dimov's avatar Vasil Dimov

Fix Bug#14708715 CREATE TABLE MEMORY LEAK ON DB_OUT_OF_FILE_SPACE

The problem is in the error handling in row_create_table_for_mysql().
In the 'disk full' case we may forget to call dict_mem_table_free() on
the table object.

Approved by:	Marko (rb:1377 and rb:1386)
parent b0662086
...@@ -1249,6 +1249,22 @@ os_file_create( ...@@ -1249,6 +1249,22 @@ os_file_create(
ulint type, /*!< in: OS_DATA_FILE or OS_LOG_FILE */ ulint type, /*!< in: OS_DATA_FILE or OS_LOG_FILE */
ibool* success)/*!< out: TRUE if succeed, FALSE if error */ ibool* success)/*!< out: TRUE if succeed, FALSE if error */
{ {
#ifdef __WIN__
DBUG_EXECUTE_IF(
"ib_create_table_fail_disk_full",
*success = FALSE;
SetLastError(ERROR_DISK_FULL);
return((os_file_t) -1);
);
#else /* __WIN__ */
DBUG_EXECUTE_IF(
"ib_create_table_fail_disk_full",
*success = FALSE;
errno = ENOSPC;
return((os_file_t) -1);
);
#endif /* __WIN__ */
#ifdef __WIN__ #ifdef __WIN__
os_file_t file; os_file_t file;
DWORD share_mode = FILE_SHARE_READ; DWORD share_mode = FILE_SHARE_READ;
......
...@@ -1768,7 +1768,8 @@ Creates a table for MySQL. If the name of the table ends in ...@@ -1768,7 +1768,8 @@ Creates a table for MySQL. If the name of the table ends in
one of "innodb_monitor", "innodb_lock_monitor", "innodb_tablespace_monitor", one of "innodb_monitor", "innodb_lock_monitor", "innodb_tablespace_monitor",
"innodb_table_monitor", then this will also start the printing of monitor "innodb_table_monitor", then this will also start the printing of monitor
output by the master thread. If the table name ends in "innodb_mem_validate", output by the master thread. If the table name ends in "innodb_mem_validate",
InnoDB will try to invoke mem_validate(). InnoDB will try to invoke mem_validate(). On failure the transaction will
be rolled back and the 'table' object will be freed.
@return error code or DB_SUCCESS */ @return error code or DB_SUCCESS */
UNIV_INTERN UNIV_INTERN
int int
...@@ -1907,6 +1908,8 @@ err_exit: ...@@ -1907,6 +1908,8 @@ err_exit:
row_drop_table_for_mysql(table->name, trx, FALSE); row_drop_table_for_mysql(table->name, trx, FALSE);
trx_commit_for_mysql(trx); trx_commit_for_mysql(trx);
} else {
dict_mem_table_free(table);
} }
break; break;
......
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