aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_db_util.c
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2011-07-12 16:17:42 +0200
committerSverker Eriksson <[email protected]>2011-07-12 16:17:42 +0200
commit66829b77b0becadecb2fef480b66f69e95498bf7 (patch)
tree0831a7255d5b2b5e024cbe0f00856ae3e4aa1fec /erts/emulator/beam/erl_db_util.c
parent80865e03583ebbee63a2a72be708f28c1e4a4f98 (diff)
parent089b8c357f5e7c96605c8f8cab4b3c856081dc39 (diff)
downloadotp-66829b77b0becadecb2fef480b66f69e95498bf7.tar.gz
otp-66829b77b0becadecb2fef480b66f69e95498bf7.tar.bz2
otp-66829b77b0becadecb2fef480b66f69e95498bf7.zip
Merge branch 'dev' into major
Diffstat (limited to 'erts/emulator/beam/erl_db_util.c')
-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 f9896a60e6..7dfbb2ed02 100644
--- a/erts/emulator/beam/erl_db_util.c
+++ b/erts/emulator/beam/erl_db_util.c
@@ -1732,6 +1732,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; \
@@ -1742,6 +1743,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)