aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2018-10-09 12:29:52 +0200
committerSverker Eriksson <[email protected]>2018-10-09 12:29:52 +0200
commit8018680cc1977ac2d70c070a5761cfe2db914821 (patch)
tree99aef2b6de8c9ac3ad89c39d174adb0084f1fd4a /erts
parent21e5a830ddcdb6efe62d46f491d7aa07e0184c89 (diff)
parentaa086af7156490e22d139ab2938544ad07714169 (diff)
downloadotp-8018680cc1977ac2d70c070a5761cfe2db914821.tar.gz
otp-8018680cc1977ac2d70c070a5761cfe2db914821.tar.bz2
otp-8018680cc1977ac2d70c070a5761cfe2db914821.zip
Merge branch 'sverker/erts/ets-select_replace-bug/OTP-15346' into maint
* sverker/erts/ets-select_replace-bug/OTP-15346: erts: Fix bug in ets:select_replace for bound key
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/beam/erl_db_tree.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/erts/emulator/beam/erl_db_tree.c b/erts/emulator/beam/erl_db_tree.c
index 788718ab09..45e4be2426 100644
--- a/erts/emulator/beam/erl_db_tree.c
+++ b/erts/emulator/beam/erl_db_tree.c
@@ -1860,22 +1860,14 @@ static int db_select_replace_tree(Process *p, DbTable *tbl, Eterm tid,
sc.mp = mpi.mp;
- stack = get_static_stack(tb);
if (!mpi.got_partial && mpi.some_limitation &&
CMP_EQ(mpi.least,mpi.most)) {
- TreeDbTerm* term = *(mpi.save_term);
doit_select_replace(tb,mpi.save_term,&sc,0 /* dummy */);
- if (stack != NULL) {
- if (TOP_NODE(stack) == term)
- // throw away potentially invalid reference
- REPLACE_TOP_NODE(stack, *(mpi.save_term));
- release_stack(tb, stack);
- }
+ reset_static_stack(tb); /* may refer replaced term */
RET_TO_BIF(erts_make_integer(sc.replaced,p),DB_ERROR_NONE);
}
- if (stack == NULL)
- stack = get_any_stack(tb);
+ stack = get_any_stack(tb);
if (mpi.some_limitation) {
if ((this = find_next_from_pb_key(tb, stack, mpi.most)) != NULL) {