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) {
elts[2] = le_malloc("x", "xval");
MALLOC_N(sn.n_children, sn.bp);
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;
BP_STATE(&sn,0) = PT_AVAIL;
BP_STATE(&sn,1) = PT_AVAIL;
......
......@@ -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));
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;
}
}
......@@ -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);
}
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;
}
}
......
......@@ -88,7 +88,7 @@ make_tree(FT_HANDLE brt, int height, int fanout, int nperleaf, int *seq, int *mi
} else {
int k = maxkeys[childnum-1]; // use the max of the left tree
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);
insert_into_child_buffer(brt, node, childnum, minkeys[childnum], maxkeys[childnum]);
......
......@@ -161,7 +161,7 @@ test_split_on_boundary(void)
insert_dummy_value(&sn, bn, k);
}
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);
}
}
......@@ -221,7 +221,7 @@ test_split_with_everything_on_the_left(void)
k = bn * eltsperbn + i;
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);
} else {
k = bn * eltsperbn;
......@@ -293,7 +293,7 @@ test_split_on_boundary_of_last_node(void)
k = bn * eltsperbn + i;
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);
} else {
k = bn * eltsperbn;
......@@ -362,7 +362,7 @@ test_split_at_begin(void)
totalbytes += insert_dummy_value(&sn, bn, k);
}
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);
}
}
......@@ -441,7 +441,7 @@ test_split_at_end(void)
}
}
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);
}
}
......@@ -495,7 +495,7 @@ test_split_odd_nodes(void)
insert_dummy_value(&sn, bn, k);
}
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);
}
}
......
......@@ -65,7 +65,7 @@ make_tree(FT_HANDLE brt, int height, int fanout, int nperleaf, int *seq, int *mi
} else {
int k = minkeys[childnum]; // use the min key of the right subtree, which creates a broken tree
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);
}
......
......@@ -79,7 +79,7 @@ make_tree(FT_HANDLE brt, int height, int fanout, int nperleaf, int *seq, int *mi
} else {
int k = maxkeys[childnum-1]; // use the max of the left tree
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);
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
} else {
int k = minkeys[fanout - childnum - 1]; // use unsorted pivots
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);
}
......
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