Commit 74d75d6d authored by Yoni Fogel's avatar Yoni Fogel

Addresses #293

Bugfixes in locktree.  Copy the payload to the memory allocated for it


git-svn-id: file:///svn/tokudb@1883 c7de825b-a66e-492c-adef-691d508d4ae1
parent fd7d3106
...@@ -112,7 +112,7 @@ static int __toku_payload_copy(toku_lock_tree* tree, ...@@ -112,7 +112,7 @@ static int __toku_payload_copy(toku_lock_tree* tree,
*payload_out = tree->malloc(len_in); *payload_out = tree->malloc(len_in);
if (!*payload_out) return errno; if (!*payload_out) return errno;
*len_out = len_in; *len_out = len_in;
memcpy(payload_out, payload_in, len_in); memcpy(*payload_out, payload_in, len_in);
} }
return 0; return 0;
} }
...@@ -597,7 +597,8 @@ static void __toku_lt_free_contents(toku_lock_tree* tree, toku_range_tree* rt) { ...@@ -597,7 +597,8 @@ static void __toku_lt_free_contents(toku_lock_tree* tree, toku_range_tree* rt) {
unsigned numfound; unsigned numfound;
r = toku_rt_find(rt, &query, 0, &tree->buf, &tree->buflen, &numfound); r = toku_rt_find(rt, &query, 0, &tree->buf, &tree->buflen, &numfound);
if (r!=0) { if (r==0) __toku_lt_free_points(tree, &query, numfound);
else {
/* /*
To free space the fast way, we need to allocate more space. To free space the fast way, we need to allocate more space.
Since we can't, we free the slow way. Since we can't, we free the slow way.
...@@ -615,7 +616,6 @@ static void __toku_lt_free_contents(toku_lock_tree* tree, toku_range_tree* rt) { ...@@ -615,7 +616,6 @@ static void __toku_lt_free_contents(toku_lock_tree* tree, toku_range_tree* rt) {
__toku_lt_free_points(tree, &query, numfound); __toku_lt_free_points(tree, &query, numfound);
} while (TRUE); } while (TRUE);
} }
else __toku_lt_free_points(tree, &query, numfound);
r = toku_rt_close(rt); r = toku_rt_close(rt);
assert(r == 0); assert(r == 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