aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2017-11-15 13:27:06 +0100
committerSverker Eriksson <[email protected]>2017-11-15 13:27:06 +0100
commit567cdef0b7b0192f0bb9b7a552ce6868795efae0 (patch)
tree19fa61600caf9b3080365cab784d57926b42e681 /erts/emulator/beam
parent8c42d5dc4f85d540c53cf24c85de6372c89ec486 (diff)
downloadotp-567cdef0b7b0192f0bb9b7a552ce6868795efae0.tar.gz
otp-567cdef0b7b0192f0bb9b7a552ce6868795efae0.tar.bz2
otp-567cdef0b7b0192f0bb9b7a552ce6868795efae0.zip
erts: Fix NIF debug readonly check of binaries
when done by enif_free_env or enif_clear_env. Do check before we free heap fragments.
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r--erts/emulator/beam/erl_nif.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/erts/emulator/beam/erl_nif.c b/erts/emulator/beam/erl_nif.c
index 3ade17b10d..f67b67325d 100644
--- a/erts/emulator/beam/erl_nif.c
+++ b/erts/emulator/beam/erl_nif.c
@@ -550,6 +550,9 @@ void enif_clear_env(ErlNifEnv* env)
ASSERT(p == menv->env.proc);
ASSERT(p->common.id == ERTS_INVALID_PID);
ASSERT(MBUF(p) == menv->env.heap_frag);
+
+ free_tmp_objs(env);
+
if (MBUF(p) != NULL) {
erts_cleanup_offheap(&MSO(p));
clear_offheap(&MSO(p));
@@ -561,7 +564,6 @@ void enif_clear_env(ErlNifEnv* env)
menv->env.hp = menv->env.hp_end = HEAP_TOP(p);
ASSERT(!is_offheap(&MSO(p)));
- free_tmp_objs(env);
}
#ifdef ERTS_SMP