mirror of
https://github.com/MariaDB/server.git
synced 2025-02-02 03:51:50 +01:00
refs #5351 fix memory leak on main
git-svn-id: file:///svn/toku/tokudb@49965 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
parent
5e77abda14
commit
44a1de0280
2 changed files with 7 additions and 24 deletions
29
ft/ft-ops.cc
29
ft/ft-ops.cc
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue