summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/btree/bt_ret.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/third_party/wiredtiger/src/btree/bt_ret.c')
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_ret.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/third_party/wiredtiger/src/btree/bt_ret.c b/src/third_party/wiredtiger/src/btree/bt_ret.c
index 3709c112c2b..6180c085ebf 100644
--- a/src/third_party/wiredtiger/src/btree/bt_ret.c
+++ b/src/third_party/wiredtiger/src/btree/bt_ret.c
@@ -39,15 +39,14 @@ __key_return(WT_CURSOR_BTREE *cbt)
return (0);
}
+ /*
+ * If there's an exact match, the row-store search function built the key we want to return
+ * in the cursor's temporary buffer. Swap the cursor's search-key and temporary buffers so
+ * we can return it (it's unsafe to return the temporary buffer itself because our caller
+ * might do another search in this table using the key we return, and we'd corrupt the
+ * search key during any subsequent search that used the temporary buffer).
+ */
if (cbt->compare == 0) {
- /*
- * If not in an insert list and there's an exact match, the row-store search function
- * built the key we want to return in the cursor's temporary buffer. Swap the cursor's
- * search-key and temporary buffers so we can return it (it's unsafe to return the
- * temporary buffer itself because our caller might do another search in this table
- * using the key we return, and we'd corrupt the search key during any subsequent search
- * that used the temporary buffer).
- */
tmp = cbt->row_key;
cbt->row_key = cbt->tmp;
cbt->tmp = tmp;