Commit 44a1de02 authored by John Esmet's avatar John Esmet Committed by Yoni Fogel

refs #5351 fix memory leak on main


git-svn-id: file:///svn/toku/tokudb@49965 c7de825b-a66e-492c-adef-691d508d4ae1
parent 5e77abda
......@@ -3912,41 +3912,24 @@ void
toku_ft_cursor_set_range_lock(FT_CURSOR cursor, const DBT *left, const DBT *right,
bool left_is_neg_infty, bool right_is_pos_infty)
{
if (cursor->range_lock_left_key.data) {
toku_free(cursor->range_lock_left_key.data);
toku_init_dbt(&cursor->range_lock_left_key);
}
if (cursor->range_lock_right_key.data) {
toku_free(cursor->range_lock_right_key.data);
toku_init_dbt(&cursor->range_lock_right_key);
}
// Destroy any existing keys and then clone the given left, right keys
toku_destroy_dbt(&cursor->range_lock_left_key);
if (left_is_neg_infty) {
cursor->left_is_neg_infty = true;
} else {
toku_fill_dbt(&cursor->range_lock_left_key,
toku_xmemdup(left->data, left->size), left->size);
toku_clone_dbt(&cursor->range_lock_left_key, *left);
}
toku_destroy_dbt(&cursor->range_lock_right_key);
if (right_is_pos_infty) {
cursor->right_is_pos_infty = true;
} else {
toku_fill_dbt(&cursor->range_lock_right_key,
toku_xmemdup(right->data, right->size), right->size);
toku_clone_dbt(&cursor->range_lock_right_key, *right);
}
}
void toku_ft_cursor_close(FT_CURSOR cursor) {
ft_cursor_cleanup_dbts(cursor);
#if 0
if (cursor->range_lock_left_key.data) {
toku_free(cursor->range_lock_left_key.data);
toku_destroy_dbt(&cursor->range_lock_left_key);
}
if (cursor->range_lock_right_key.data) {
toku_free(cursor->range_lock_right_key.data);
toku_destroy_dbt(&cursor->range_lock_right_key);
}
#endif
toku_destroy_dbt(&cursor->range_lock_left_key);
toku_destroy_dbt(&cursor->range_lock_right_key);
toku_free(cursor);
......
......@@ -30,7 +30,7 @@ toku_destroy_dbt(DBT *dbt) {
case DB_DBT_MALLOC:
case DB_DBT_REALLOC:
toku_free(dbt->data);
dbt->data = NULL;
toku_init_dbt(dbt);
break;
}
}
......
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