aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2012-03-06 11:28:58 +0100
committerSverker Eriksson <[email protected]>2012-03-06 11:28:58 +0100
commit869237370df8133f0252ad2f803fcd6a152d98e7 (patch)
tree8afee5a626e4ecca14dc886f0e3c941f24f13a93 /erts/emulator/beam
parent07e6f64d26878d56e7520ddd262f995ac69737f7 (diff)
downloadotp-869237370df8133f0252ad2f803fcd6a152d98e7.tar.gz
otp-869237370df8133f0252ad2f803fcd6a152d98e7.tar.bz2
otp-869237370df8133f0252ad2f803fcd6a152d98e7.zip
erts: Fix memory leak in code loading
All magic binaries returned by prepare_loading/2 was leaking. prepare_loading/2 left the reference count as 2 of the magic binary when it should be 1 (only owned by the returned term).
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r--erts/emulator/beam/beam_bif_load.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/erts/emulator/beam/beam_bif_load.c b/erts/emulator/beam/beam_bif_load.c
index 67c8442636..768c38dae1 100644
--- a/erts/emulator/beam/beam_bif_load.c
+++ b/erts/emulator/beam/beam_bif_load.c
@@ -136,6 +136,7 @@ prepare_loading_2(BIF_ALIST_2)
}
hp = HAlloc(BIF_P, PROC_BIN_SIZE);
res = erts_mk_magic_binary_term(&hp, &MSO(BIF_P), magic);
+ erts_refc_dec(&magic->refc, 1);
BIF_RET(res);
}