diff options
author | Sverker Eriksson <sverker@erlang.org> | 2018-10-09 12:28:12 +0200 |
---|---|---|
committer | Sverker Eriksson <sverker@erlang.org> | 2018-10-09 12:28:12 +0200 |
commit | aa086af7156490e22d139ab2938544ad07714169 (patch) | |
tree | 539755b94e3a2a64b55a017b416fbeb4a9854804 /erts | |
parent | 040bdce67f88d833bfb59adae130a4ffb4c180f0 (diff) | |
download | erlang-aa086af7156490e22d139ab2938544ad07714169.tar.gz |
erts: Fix bug in ets:select_replace for bound key
which may cause following calls to ets:next or ets:prev to fail.
Diffstat (limited to 'erts')
-rw-r--r-- | erts/emulator/beam/erl_db_tree.c | 12 |
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 d7deadacf0..f0c01e6e78 100644 --- a/erts/emulator/beam/erl_db_tree.c +++ b/erts/emulator/beam/erl_db_tree.c @@ -1887,22 +1887,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) { |