From ed81bb9ed8114d2059783e2c2fdae526d3a36e1e Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Mon, 15 Feb 2016 19:26:54 +0100 Subject: 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. --- erts/emulator/beam/erl_nif.c | 5 +---- 1 file changed, 1 insertion(+), 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; } -- cgit v1.2.3