mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
DB-787 the tokudb_report_fractal_tree_info_for_db function can leak a db on an error path where db->open fails
This commit is contained in:
parent
78bc6e37ad
commit
efb32d4644
1 changed files with 6 additions and 7 deletions
|
@ -1614,12 +1614,12 @@ static ST_FIELD_INFO tokudb_fractal_tree_info_field_info[] = {
|
|||
|
||||
static int tokudb_report_fractal_tree_info_for_db(const DBT *dname, const DBT *iname, TABLE *table, THD *thd) {
|
||||
int error;
|
||||
DB *db;
|
||||
uint64_t bt_num_blocks_allocated;
|
||||
uint64_t bt_num_blocks_in_use;
|
||||
uint64_t bt_size_allocated;
|
||||
uint64_t bt_size_in_use;
|
||||
|
||||
DB *db = NULL;
|
||||
error = db_create(&db, db_env, 0);
|
||||
if (error) {
|
||||
goto exit;
|
||||
|
@ -1631,12 +1631,6 @@ static int tokudb_report_fractal_tree_info_for_db(const DBT *dname, const DBT *i
|
|||
error = db->get_fractal_tree_info64(db,
|
||||
&bt_num_blocks_allocated, &bt_num_blocks_in_use,
|
||||
&bt_size_allocated, &bt_size_in_use);
|
||||
{
|
||||
int close_error = db->close(db, 0);
|
||||
if (!error) {
|
||||
error = close_error;
|
||||
}
|
||||
}
|
||||
if (error) {
|
||||
goto exit;
|
||||
}
|
||||
|
@ -1668,6 +1662,11 @@ static int tokudb_report_fractal_tree_info_for_db(const DBT *dname, const DBT *i
|
|||
error = schema_table_store_record(thd, table);
|
||||
|
||||
exit:
|
||||
if (db) {
|
||||
int close_error = db->close(db, 0);
|
||||
if (error == 0)
|
||||
error = close_error;
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue