aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/dist.c
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2017-02-03 15:22:48 +0100
committerSverker Eriksson <[email protected]>2017-02-03 17:23:35 +0100
commit3fe6f3c0caecec522c7e14353eda6bbb86c9e8d6 (patch)
tree29710e0dcc08a4798d61027f2f7762a0fc275ad8 /erts/emulator/beam/dist.c
parent69b928b12d9206d00879c08e46143f599f9dc34e (diff)
downloadotp-3fe6f3c0caecec522c7e14353eda6bbb86c9e8d6.tar.gz
otp-3fe6f3c0caecec522c7e14353eda6bbb86c9e8d6.tar.bz2
otp-3fe6f3c0caecec522c7e14353eda6bbb86c9e8d6.zip
erts: Add deallocation veto for magic destructors
A magic destructor can return 0 and thereby take control and prolong the lifetime of a magic binary.
Diffstat (limited to 'erts/emulator/beam/dist.c')
-rw-r--r--erts/emulator/beam/dist.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/erts/emulator/beam/dist.c b/erts/emulator/beam/dist.c
index 990edb274e..9e8f853279 100644
--- a/erts/emulator/beam/dist.c
+++ b/erts/emulator/beam/dist.c
@@ -713,7 +713,7 @@ static void clear_dist_entry(DistEntry *dep)
}
}
-void erts_dsend_context_dtor(Binary* ctx_bin)
+int erts_dsend_context_dtor(Binary* ctx_bin)
{
ErtsSendContext* ctx = ERTS_MAGIC_BIN_DATA(ctx_bin);
switch (ctx->dss.phase) {
@@ -730,6 +730,8 @@ void erts_dsend_context_dtor(Binary* ctx_bin)
}
if (ctx->dep_to_deref)
erts_deref_dist_entry(ctx->dep_to_deref);
+
+ return 1;
}
Eterm erts_dsend_export_trap_context(Process* p, ErtsSendContext* ctx)