summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorRich Prohaska <prohaska@tokutek.com>2015-01-04 12:13:54 -0500
committerRich Prohaska <prohaska@tokutek.com>2015-01-04 12:13:54 -0500
commitefb32d4644d4943e4e1d739a8a66e2fc6280f42e (patch)
treeb5e43e11d2ace1f87608c31b3b55eeefa39b5de3 /storage
parent78bc6e37ad92b9ae4cb22f5967211ce2c3751941 (diff)
downloadmariadb-git-efb32d4644d4943e4e1d739a8a66e2fc6280f42e.tar.gz
DB-787 the tokudb_report_fractal_tree_info_for_db function can leak a db on an error path where db->open fails
Diffstat (limited to 'storage')
-rw-r--r--storage/tokudb/hatoku_hton.cc13
1 files changed, 6 insertions, 7 deletions
diff --git a/storage/tokudb/hatoku_hton.cc b/storage/tokudb/hatoku_hton.cc
index 83a1053a2d8..ff849256f77 100644
--- a/storage/tokudb/hatoku_hton.cc
+++ b/storage/tokudb/hatoku_hton.cc
@@ -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;
}