diff options
author | Sverker Eriksson <[email protected]> | 2017-02-14 18:26:31 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2017-02-14 18:26:31 +0100 |
commit | 118de47d703e303aea7f4575849a37c11416ba14 (patch) | |
tree | 211bbb6c24d6069c657d3b7ac7776be45631ec48 /erts/emulator/beam/binary.c | |
parent | dd60ebfa1f2f6dc203deee59f95305291d06a619 (diff) | |
download | otp-118de47d703e303aea7f4575849a37c11416ba14.tar.gz otp-118de47d703e303aea7f4575849a37c11416ba14.tar.bz2 otp-118de47d703e303aea7f4575849a37c11416ba14.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/binary.c')
-rw-r--r-- | erts/emulator/beam/binary.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/erts/emulator/beam/binary.c b/erts/emulator/beam/binary.c index d38097fb12..be43f6e1ac 100644 --- a/erts/emulator/beam/binary.c +++ b/erts/emulator/beam/binary.c @@ -350,9 +350,10 @@ typedef struct { Uint bitoffs; } ErtsB2LState; -static void b2l_state_destructor(Binary *mbp) +static int b2l_state_destructor(Binary *mbp) { ASSERT(ERTS_MAGIC_BIN_DESTRUCTOR(mbp) == b2l_state_destructor); + return 1; } static BIF_RETTYPE @@ -723,12 +724,13 @@ list_to_binary_engine(ErtsL2BState *sp) } } -static void +static int l2b_state_destructor(Binary *mbp) { ErtsL2BState *sp = ERTS_MAGIC_BIN_DATA(mbp); ASSERT(ERTS_MAGIC_BIN_DESTRUCTOR(mbp) == l2b_state_destructor); DESTROY_SAVED_ESTACK(&sp->buf.iolist.estack); + return 1; } static ERTS_INLINE Eterm |