Commit 5597c57c 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 3c00096e
Branches unavailable
Tags unavailable
No related merge requests found
...@@ -5867,8 +5867,8 @@ int ha_tokudb::optimize(THD * thd, HA_CHECK_OPT * check_opt) { ...@@ -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 each DB, scan through entire table and do nothing
// //
for (uint i = 0; i < curr_num_DBs; i++) { for (uint i = 0; i < curr_num_DBs; i++) {
error = 0; error = share->key_file[i]->cursor(share->key_file[i], txn, &tmp_cursor, 0);
if ((error = share->key_file[i]->cursor(share->key_file[i], txn, &tmp_cursor, 0))) { if (error) {
tmp_cursor = NULL; tmp_cursor = NULL;
goto cleanup; goto cleanup;
} }
...@@ -5879,10 +5879,15 @@ int ha_tokudb::optimize(THD * thd, HA_CHECK_OPT * check_opt) { ...@@ -5879,10 +5879,15 @@ int ha_tokudb::optimize(THD * thd, HA_CHECK_OPT * check_opt) {
} }
} }
tmp_cursor->c_close(tmp_cursor); tmp_cursor->c_close(tmp_cursor);
tmp_cursor = NULL;
} }
error = 0; error = 0;
cleanup: cleanup:
if (tmp_cursor) {
tmp_cursor->c_close(tmp_cursor);
tmp_cursor = NULL;
}
if (do_commit) { if (do_commit) {
error = txn->commit(txn, 0); 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