Commit 412ee033 authored by Marko Mäkelä's avatar Marko Mäkelä

Fix a memory leak on aborted InnoDB startup.

innodb_shutdown(), trx_sys_close(): Startup may be aborted between
purge_sys and trx_sys creation. Therefore, purge_sys must be freed
independently of trx_sys.

innobase_start_or_create_for_mysql(): Remember to free purge_queue if
it was not yet attached to purge_sys.
parent d35aea54
...@@ -2206,6 +2206,7 @@ innobase_start_or_create_for_mysql(void) ...@@ -2206,6 +2206,7 @@ innobase_start_or_create_for_mysql(void)
DBUG_PRINT("ib_log", ("apply completed")); DBUG_PRINT("ib_log", ("apply completed"));
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
UT_DELETE(purge_queue);
return(srv_init_abort(err)); return(srv_init_abort(err));
} }
...@@ -2280,6 +2281,7 @@ innobase_start_or_create_for_mysql(void) ...@@ -2280,6 +2281,7 @@ innobase_start_or_create_for_mysql(void)
" a startup if you are trying to" " a startup if you are trying to"
" recover a badly corrupt database."; " recover a badly corrupt database.";
UT_DELETE(purge_queue);
return(srv_init_abort(DB_ERROR)); return(srv_init_abort(DB_ERROR));
} }
} }
...@@ -2796,6 +2798,9 @@ innodb_shutdown() ...@@ -2796,6 +2798,9 @@ innodb_shutdown()
trx_sys_file_format_close(); trx_sys_file_format_close();
trx_sys_close(); trx_sys_close();
} }
if (purge_sys) {
trx_purge_sys_close();
}
if (buf_dblwr) { if (buf_dblwr) {
buf_dblwr_free(); buf_dblwr_free();
} }
......
...@@ -1092,10 +1092,6 @@ trx_sys_close(void) ...@@ -1092,10 +1092,6 @@ trx_sys_close(void)
trx_dummy_sess = NULL; trx_dummy_sess = NULL;
} }
if (purge_sys) {
trx_purge_sys_close();
}
/* Only prepared transactions may be left in the system. Free them. */ /* Only prepared transactions may be left in the system. Free them. */
ut_a(UT_LIST_GET_LEN(trx_sys->rw_trx_list) == trx_sys->n_prepared_trx ut_a(UT_LIST_GET_LEN(trx_sys->rw_trx_list) == trx_sys->n_prepared_trx
|| !srv_was_started || !srv_was_started
......
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