Commit 6fb765db authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

[t:2022], fix some cleanup code

git-svn-id: file:///svn/mysql/tokudb-engine/src@14598 c7de825b-a66e-492c-adef-691d508d4ae1
parent bd66fffb
......@@ -5867,8 +5867,8 @@ int ha_tokudb::optimize(THD * thd, HA_CHECK_OPT * check_opt) {
// for each DB, scan through entire table and do nothing
//
for (uint i = 0; i < curr_num_DBs; i++) {
error = 0;
if ((error = share->key_file[i]->cursor(share->key_file[i], txn, &tmp_cursor, 0))) {
error = share->key_file[i]->cursor(share->key_file[i], txn, &tmp_cursor, 0);
if (error) {
tmp_cursor = NULL;
goto cleanup;
}
......@@ -5879,10 +5879,15 @@ int ha_tokudb::optimize(THD * thd, HA_CHECK_OPT * check_opt) {
}
}
tmp_cursor->c_close(tmp_cursor);
tmp_cursor = NULL;
}
error = 0;
cleanup:
if (tmp_cursor) {
tmp_cursor->c_close(tmp_cursor);
tmp_cursor = NULL;
}
if (do_commit) {
error = txn->commit(txn, 0);
}
......
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