aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/beam_load.c
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-09-15 11:40:39 +0200
committerBjörn Gustavsson <[email protected]>2016-09-15 11:40:39 +0200
commit687eae1e86817403249f03f534a256a28c5d5251 (patch)
tree75369a6be94deb0e0c0ad2287102dbb16c34b026 /erts/emulator/beam/beam_load.c
parent060949fb1ee7d1af366372b43dde5add421a5f73 (diff)
parentfde238fb52133a6c7a2a3f2a2e16f1c1bef62394 (diff)
downloadotp-687eae1e86817403249f03f534a256a28c5d5251.tar.gz
otp-687eae1e86817403249f03f534a256a28c5d5251.tar.bz2
otp-687eae1e86817403249f03f534a256a28c5d5251.zip
Merge branch 'maint'
* maint: erts: Add nif_SUITE:t_on_load erts: Improve nif_SUITE:upgrade test Don't leak old code when loading a modules with an on_load function Conflicts: erts/preloaded/ebin/erts_code_purger.beam erts/preloaded/ebin/erts_internal.beam erts/preloaded/src/erts_code_purger.erl
Diffstat (limited to 'erts/emulator/beam/beam_load.c')
-rw-r--r--erts/emulator/beam/beam_load.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/erts/emulator/beam/beam_load.c b/erts/emulator/beam/beam_load.c
index d1f9e6c91c..d69b18e22f 100644
--- a/erts/emulator/beam/beam_load.c
+++ b/erts/emulator/beam/beam_load.c
@@ -833,11 +833,20 @@ erts_finish_loading(Binary* magic, Process* c_p,
size = stp->loaded_size;
erts_total_code_size += size;
- if (stp->on_load) {
- inst_p = &mod_tab_p->old;
- } else {
+
+ if (!stp->on_load) {
inst_p = &mod_tab_p->curr;
+ } else {
+ mod_tab_p->on_load =
+ (struct erl_module_instance *)
+ erts_alloc(ERTS_ALC_T_PREPARED_CODE,
+ sizeof(struct erl_module_instance));
+ inst_p = mod_tab_p->on_load;
+ inst_p->nif = 0;
+ inst_p->num_breakpoints = 0;
+ inst_p->num_traced_exports = 0;
}
+
inst_p->code_hdr = stp->hdr;
inst_p->code_length = size;