Commit 95a8538e authored by John Esmet's avatar John Esmet Committed by Yoni Fogel

refs #5723 fix some test memory leaks


git-svn-id: file:///svn/toku/tokudb@51709 c7de825b-a66e-492c-adef-691d508d4ae1
parent 2c1a677d
...@@ -352,7 +352,7 @@ test_serialize_leaf(void) { ...@@ -352,7 +352,7 @@ test_serialize_leaf(void) {
elts[2] = le_malloc("x", "xval"); elts[2] = le_malloc("x", "xval");
MALLOC_N(sn.n_children, sn.bp); MALLOC_N(sn.n_children, sn.bp);
MALLOC_N(1, sn.childkeys); MALLOC_N(1, sn.childkeys);
toku_fill_dbt(&sn.childkeys[0], toku_xmemdup("b", 2), 2); toku_memdup_dbt(&sn.childkeys[0], "b", 2);
sn.totalchildkeylens = 2; sn.totalchildkeylens = 2;
BP_STATE(&sn,0) = PT_AVAIL; BP_STATE(&sn,0) = PT_AVAIL;
BP_STATE(&sn,1) = PT_AVAIL; BP_STATE(&sn,1) = PT_AVAIL;
......
...@@ -102,7 +102,7 @@ test_serialize_leaf(int valsize, int nelts, double entropy) { ...@@ -102,7 +102,7 @@ test_serialize_leaf(int valsize, int nelts, double entropy) {
} }
BLB_NBYTESINBUF(sn, ck) = nperbn*(KEY_VALUE_OVERHEAD+(sizeof(long)+valsize)) + toku_omt_size(BLB_BUFFER(sn, ck)); BLB_NBYTESINBUF(sn, ck) = nperbn*(KEY_VALUE_OVERHEAD+(sizeof(long)+valsize)) + toku_omt_size(BLB_BUFFER(sn, ck));
if (ck < 7) { if (ck < 7) {
toku_fill_dbt(&sn->childkeys[ck], toku_xmemdup(&k, sizeof k), sizeof k); toku_memdup_dbt(&sn->childkeys[ck], &k, sizeof k);
sn->totalchildkeylens += sizeof k; sn->totalchildkeylens += sizeof k;
} }
} }
...@@ -229,7 +229,7 @@ test_serialize_nonleaf(int valsize, int nelts, double entropy) { ...@@ -229,7 +229,7 @@ test_serialize_nonleaf(int valsize, int nelts, double entropy) {
toku_bnc_insert_msg(bnc, &k, sizeof k, buf, valsize, FT_NONE, next_dummymsn(), xids_123, true, NULL, long_key_cmp); toku_bnc_insert_msg(bnc, &k, sizeof k, buf, valsize, FT_NONE, next_dummymsn(), xids_123, true, NULL, long_key_cmp);
} }
if (ck < 7) { if (ck < 7) {
toku_fill_dbt(&sn.childkeys[ck], toku_xmemdup(&k, sizeof k), sizeof k); toku_memdup_dbt(&sn.childkeys[ck], &k, sizeof k);
sn.totalchildkeylens += sizeof k; sn.totalchildkeylens += sizeof k;
} }
} }
......
...@@ -88,7 +88,7 @@ make_tree(FT_HANDLE brt, int height, int fanout, int nperleaf, int *seq, int *mi ...@@ -88,7 +88,7 @@ make_tree(FT_HANDLE brt, int height, int fanout, int nperleaf, int *seq, int *mi
} else { } else {
int k = maxkeys[childnum-1]; // use the max of the left tree int k = maxkeys[childnum-1]; // use the max of the left tree
DBT pivotkey; DBT pivotkey;
toku_ft_nonleaf_append_child(node, child, toku_fill_dbt(&pivotkey, toku_xmemdup(&k, sizeof k), sizeof k)); toku_ft_nonleaf_append_child(node, child, toku_fill_dbt(&pivotkey, &k, sizeof k));
} }
toku_unpin_ftnode(brt->ft, child); toku_unpin_ftnode(brt->ft, child);
insert_into_child_buffer(brt, node, childnum, minkeys[childnum], maxkeys[childnum]); insert_into_child_buffer(brt, node, childnum, minkeys[childnum], maxkeys[childnum]);
......
...@@ -161,7 +161,7 @@ test_split_on_boundary(void) ...@@ -161,7 +161,7 @@ test_split_on_boundary(void)
insert_dummy_value(&sn, bn, k); insert_dummy_value(&sn, bn, k);
} }
if (bn < sn.n_children - 1) { if (bn < sn.n_children - 1) {
toku_fill_dbt(&sn.childkeys[bn], toku_xmemdup(&k, sizeof k), sizeof k); toku_memdup_dbt(&sn.childkeys[bn], &k, sizeof k);
sn.totalchildkeylens += (sizeof k); sn.totalchildkeylens += (sizeof k);
} }
} }
...@@ -221,7 +221,7 @@ test_split_with_everything_on_the_left(void) ...@@ -221,7 +221,7 @@ test_split_with_everything_on_the_left(void)
k = bn * eltsperbn + i; k = bn * eltsperbn + i;
big_val_size += insert_dummy_value(&sn, bn, k); big_val_size += insert_dummy_value(&sn, bn, k);
} }
toku_fill_dbt(&sn.childkeys[bn], toku_xmemdup(&k, sizeof k), sizeof k); toku_memdup_dbt(&sn.childkeys[bn], &k, sizeof k);
sn.totalchildkeylens += (sizeof k); sn.totalchildkeylens += (sizeof k);
} else { } else {
k = bn * eltsperbn; k = bn * eltsperbn;
...@@ -293,7 +293,7 @@ test_split_on_boundary_of_last_node(void) ...@@ -293,7 +293,7 @@ test_split_on_boundary_of_last_node(void)
k = bn * eltsperbn + i; k = bn * eltsperbn + i;
big_val_size += insert_dummy_value(&sn, bn, k); big_val_size += insert_dummy_value(&sn, bn, k);
} }
toku_fill_dbt(&sn.childkeys[bn], toku_xmemdup(&k, sizeof k), sizeof k); toku_memdup_dbt(&sn.childkeys[bn], &k, sizeof k);
sn.totalchildkeylens += (sizeof k); sn.totalchildkeylens += (sizeof k);
} else { } else {
k = bn * eltsperbn; k = bn * eltsperbn;
...@@ -362,7 +362,7 @@ test_split_at_begin(void) ...@@ -362,7 +362,7 @@ test_split_at_begin(void)
totalbytes += insert_dummy_value(&sn, bn, k); totalbytes += insert_dummy_value(&sn, bn, k);
} }
if (bn < sn.n_children - 1) { if (bn < sn.n_children - 1) {
toku_fill_dbt(&sn.childkeys[bn], toku_xmemdup(&k, sizeof k), sizeof k); toku_memdup_dbt(&sn.childkeys[bn], &k, sizeof k);
sn.totalchildkeylens += (sizeof k); sn.totalchildkeylens += (sizeof k);
} }
} }
...@@ -441,7 +441,7 @@ test_split_at_end(void) ...@@ -441,7 +441,7 @@ test_split_at_end(void)
} }
} }
if (bn < sn.n_children - 1) { if (bn < sn.n_children - 1) {
toku_fill_dbt(&sn.childkeys[bn], toku_xmemdup(&k, sizeof k), sizeof k); toku_memdup_dbt(&sn.childkeys[bn], &k, sizeof k);
sn.totalchildkeylens += (sizeof k); sn.totalchildkeylens += (sizeof k);
} }
} }
...@@ -495,7 +495,7 @@ test_split_odd_nodes(void) ...@@ -495,7 +495,7 @@ test_split_odd_nodes(void)
insert_dummy_value(&sn, bn, k); insert_dummy_value(&sn, bn, k);
} }
if (bn < sn.n_children - 1) { if (bn < sn.n_children - 1) {
toku_fill_dbt(&sn.childkeys[bn], toku_xmemdup(&k, sizeof k), sizeof k); toku_memdup_dbt(&sn.childkeys[bn], &k, sizeof k);
sn.totalchildkeylens += (sizeof k); sn.totalchildkeylens += (sizeof k);
} }
} }
......
...@@ -65,7 +65,7 @@ make_tree(FT_HANDLE brt, int height, int fanout, int nperleaf, int *seq, int *mi ...@@ -65,7 +65,7 @@ make_tree(FT_HANDLE brt, int height, int fanout, int nperleaf, int *seq, int *mi
} else { } else {
int k = minkeys[childnum]; // use the min key of the right subtree, which creates a broken tree int k = minkeys[childnum]; // use the min key of the right subtree, which creates a broken tree
DBT pivotkey; DBT pivotkey;
toku_ft_nonleaf_append_child(node, child, toku_fill_dbt(&pivotkey, toku_xmemdup(&k, sizeof k), sizeof k)); toku_ft_nonleaf_append_child(node, child, toku_fill_dbt(&pivotkey, &k, sizeof k));
} }
toku_unpin_ftnode(brt->ft, child); toku_unpin_ftnode(brt->ft, child);
} }
......
...@@ -79,7 +79,7 @@ make_tree(FT_HANDLE brt, int height, int fanout, int nperleaf, int *seq, int *mi ...@@ -79,7 +79,7 @@ make_tree(FT_HANDLE brt, int height, int fanout, int nperleaf, int *seq, int *mi
} else { } else {
int k = maxkeys[childnum-1]; // use the max of the left tree int k = maxkeys[childnum-1]; // use the max of the left tree
DBT pivotkey; DBT pivotkey;
toku_ft_nonleaf_append_child(node, child, toku_fill_dbt(&pivotkey, toku_xmemdup(&k, sizeof k), sizeof k)); toku_ft_nonleaf_append_child(node, child, toku_fill_dbt(&pivotkey, &k, sizeof k));
} }
toku_unpin_ftnode(brt->ft, child); toku_unpin_ftnode(brt->ft, child);
insert_into_child_buffer(brt, node, childnum, minkeys[childnum], maxkeys[childnum]); insert_into_child_buffer(brt, node, childnum, minkeys[childnum], maxkeys[childnum]);
......
...@@ -65,7 +65,7 @@ make_tree(FT_HANDLE brt, int height, int fanout, int nperleaf, int *seq, int *mi ...@@ -65,7 +65,7 @@ make_tree(FT_HANDLE brt, int height, int fanout, int nperleaf, int *seq, int *mi
} else { } else {
int k = minkeys[fanout - childnum - 1]; // use unsorted pivots int k = minkeys[fanout - childnum - 1]; // use unsorted pivots
DBT pivotkey; DBT pivotkey;
toku_ft_nonleaf_append_child(node, child, toku_fill_dbt(&pivotkey, toku_xmemdup(&k, sizeof k), sizeof k)); toku_ft_nonleaf_append_child(node, child, toku_fill_dbt(&pivotkey, &k, sizeof k));
} }
toku_unpin_ftnode(brt->ft, child); toku_unpin_ftnode(brt->ft, child);
} }
......
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