aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2011-07-11 15:40:41 +0200
committerErlang/OTP <[email protected]>2011-07-11 15:40:41 +0200
commit5c100a165f59a8a3b9dec3f0d53567f228cb8171 (patch)
treee62d9069924e63f79a6f6c651be1943da16c1372 /erts
parent32fc16e311bfbc5abd0ab8caf64d566e1e65196d (diff)
parentc50b9bf4137333850e76393752495a09147e73a6 (diff)
downloadotp-5c100a165f59a8a3b9dec3f0d53567f228cb8171.tar.gz
otp-5c100a165f59a8a3b9dec3f0d53567f228cb8171.tar.bz2
otp-5c100a165f59a8a3b9dec3f0d53567f228cb8171.zip
Merge branch 'sverker/trace-ms-invalid-op/OTP-9422' into maint-r14
* sverker/trace-ms-invalid-op/OTP-9422: Fix a match-spec trace bug that could cause emulator crash
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/beam/erl_db_util.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/erts/emulator/beam/erl_db_util.c b/erts/emulator/beam/erl_db_util.c
index c3b074f782..e5be1f253a 100644
--- a/erts/emulator/beam/erl_db_util.c
+++ b/erts/emulator/beam/erl_db_util.c
@@ -1731,6 +1731,7 @@ Eterm db_prog_match(Process *c_p, Binary *bprog,
#define BEGIN_ATOMIC_TRACE(p) \
do { \
if (! atomic_trace) { \
+ erts_refc_inc(&bprog->refc, 2); \
erts_smp_proc_unlock((p), ERTS_PROC_LOCK_MAIN); \
erts_smp_block_system(0); \
atomic_trace = !0; \
@@ -1741,6 +1742,9 @@ Eterm db_prog_match(Process *c_p, Binary *bprog,
if (atomic_trace) { \
erts_smp_release_system(); \
erts_smp_proc_lock((p), ERTS_PROC_LOCK_MAIN); \
+ if (erts_refc_dectest(&bprog->refc, 0) == 0) {\
+ erts_bin_free(bprog); \
+ } \
atomic_trace = 0; \
} \
} while (0)