aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2016-02-15 19:26:54 +0100
committerLukas Larsson <[email protected]>2016-03-29 14:57:12 +0200
commited81bb9ed8114d2059783e2c2fdae526d3a36e1e (patch)
treef9ff78701117a4190ff140d375f581883e7e755c
parent0138a122226b770749218abd77a2931977af5a47 (diff)
downloadotp-ed81bb9ed8114d2059783e2c2fdae526d3a36e1e.tar.gz
otp-ed81bb9ed8114d2059783e2c2fdae526d3a36e1e.tar.bz2
otp-ed81bb9ed8114d2059783e2c2fdae526d3a36e1e.zip
erts: Fix bug in enif_send
Let cache_env() set env->heap_frag to same as MBUF(p) as it is in any other case.
-rw-r--r--erts/emulator/beam/erl_nif.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/erts/emulator/beam/erl_nif.c b/erts/emulator/beam/erl_nif.c
index c6ece8c1c7..beef6983cd 100644
--- a/erts/emulator/beam/erl_nif.c
+++ b/erts/emulator/beam/erl_nif.c
@@ -209,6 +209,7 @@ static void flush_env(ErlNifEnv* env)
*/
static void cache_env(ErlNifEnv* env)
{
+ env->heap_frag = MBUF(env->proc);
if (env->heap_frag == NULL) {
ASSERT(env->hp_end == HEAP_LIMIT(env->proc));
ASSERT(env->hp <= HEAP_TOP(env->proc));
@@ -216,10 +217,6 @@ static void cache_env(ErlNifEnv* env)
env->hp = HEAP_TOP(env->proc);
}
else {
- ASSERT(env->hp_end != HEAP_LIMIT(env->proc));
- ASSERT(env->hp_end - env->hp <= env->heap_frag->alloc_size);
- env->heap_frag = MBUF(env->proc);
- ASSERT(env->heap_frag != NULL);
env->hp = env->heap_frag->mem + env->heap_frag->used_size;
env->hp_end = env->heap_frag->mem + env->heap_frag->alloc_size;
}