aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_db_util.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/erl_db_util.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/erl_db_util.c')
-rw-r--r--erts/emulator/beam/erl_db_util.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/erts/emulator/beam/erl_db_util.c b/erts/emulator/beam/erl_db_util.c
index 4e987d5bee..991d63a18b 100644
--- a/erts/emulator/beam/erl_db_util.c
+++ b/erts/emulator/beam/erl_db_util.c
@@ -1702,17 +1702,18 @@ error: /* Here is were we land when compilation failed. */
/*
** Free a match program (in a binary)
*/
-void erts_db_match_prog_destructor(Binary *bprog)
+int erts_db_match_prog_destructor(Binary *bprog)
{
MatchProg *prog;
if (bprog == NULL)
- return;
+ return 1;
prog = Binary2MatchProg(bprog);
if (prog->term_save != NULL) {
free_message_buffer(prog->term_save);
}
if (prog->saved_program_buf != NULL)
free_message_buffer(prog->saved_program_buf);
+ return 1;
}
void