summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorVasil Dimov <vasil.dimov@oracle.com>2012-10-09 16:02:58 +0300
committerVasil Dimov <vasil.dimov@oracle.com>2012-10-09 16:02:58 +0300
commit93398c307fb682c56bea022924baf46248ffa253 (patch)
treeff161d1a48f95631aaabbabdc51766c613e5595e /storage
parentb06620868ea840beffcfaf36e905bfecd27cfa85 (diff)
downloadmariadb-git-93398c307fb682c56bea022924baf46248ffa253.tar.gz
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)
Diffstat (limited to 'storage')
-rw-r--r--storage/innodb_plugin/os/os0file.c16
-rw-r--r--storage/innodb_plugin/row/row0mysql.c5
2 files changed, 20 insertions, 1 deletions
diff --git a/storage/innodb_plugin/os/os0file.c b/storage/innodb_plugin/os/os0file.c
index ff80f7ed1b4..7f8c7c637a1 100644
--- a/storage/innodb_plugin/os/os0file.c
+++ b/storage/innodb_plugin/os/os0file.c
@@ -1250,6 +1250,22 @@ os_file_create(
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__
os_file_t file;
DWORD share_mode = FILE_SHARE_READ;
DWORD create_flag;
diff --git a/storage/innodb_plugin/row/row0mysql.c b/storage/innodb_plugin/row/row0mysql.c
index 974d67893a3..137a164c4cd 100644
--- a/storage/innodb_plugin/row/row0mysql.c
+++ b/storage/innodb_plugin/row/row0mysql.c
@@ -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",
"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",
-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 */
UNIV_INTERN
int
@@ -1907,6 +1908,8 @@ err_exit:
row_drop_table_for_mysql(table->name, trx, FALSE);
trx_commit_for_mysql(trx);
+ } else {
+ dict_mem_table_free(table);
}
break;