diff options
author | Sverker Eriksson <[email protected]> | 2017-02-03 15:22:48 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2017-02-03 17:23:35 +0100 |
commit | 3fe6f3c0caecec522c7e14353eda6bbb86c9e8d6 (patch) | |
tree | 29710e0dcc08a4798d61027f2f7762a0fc275ad8 /erts/emulator/beam/binary.c | |
parent | 69b928b12d9206d00879c08e46143f599f9dc34e (diff) | |
download | otp-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/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 071a356260..9894992b70 100644 --- a/erts/emulator/beam/binary.c +++ b/erts/emulator/beam/binary.c @@ -355,9 +355,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 @@ -729,12 +730,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 |