aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2018-10-16 15:13:07 +0200
committerErlang/OTP <[email protected]>2018-10-16 15:13:07 +0200
commit6965ac876714c5ca9ae00d48c0018f157dbb27f4 (patch)
treeb88903646cc65d26156bd68fddaf4a26ce2967e4 /erts/emulator
parent55f286cdffac63ece441e948d433375e5e95989f (diff)
parentaa086af7156490e22d139ab2938544ad07714169 (diff)
downloadotp-6965ac876714c5ca9ae00d48c0018f157dbb27f4.tar.gz
otp-6965ac876714c5ca9ae00d48c0018f157dbb27f4.tar.bz2
otp-6965ac876714c5ca9ae00d48c0018f157dbb27f4.zip
Merge branch 'sverker/erts/ets-select_replace-bug/OTP-15346' into maint-20
* sverker/erts/ets-select_replace-bug/OTP-15346: erts: Fix bug in ets:select_replace for bound key
Diffstat (limited to 'erts/emulator')
-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 7c80e92e50..1127b8d12e 100644
--- a/erts/emulator/beam/erl_db_tree.c
+++ b/erts/emulator/beam/erl_db_tree.c
@@ -1884,22 +1884,14 @@ static int db_select_replace_tree(Process *p, DbTable *tbl, Eterm tid,
sc.mp = mpi.mp;
sc.all_objects = mpi.all_objects;
- 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) {