aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2017-04-11 16:11:37 +0200
committerSverker Eriksson <[email protected]>2017-04-11 16:11:37 +0200
commit37bdfb3b5b56c2311db1780b052b7e2c0f139cef (patch)
treea47c34ab8c34e4d2470f44019fd38c512493f17b /erts
parent5e8f498b810aeae9cb4c9c3715fe62a33b84cdde (diff)
downloadotp-37bdfb3b5b56c2311db1780b052b7e2c0f139cef.tar.gz
otp-37bdfb3b5b56c2311db1780b052b7e2c0f139cef.tar.bz2
otp-37bdfb3b5b56c2311db1780b052b7e2c0f139cef.zip
erts: Init refc=1 in erts_bin_drv_alloc*
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/beam/dist.c1
-rw-r--r--erts/emulator/beam/erl_binary.h2
-rw-r--r--erts/emulator/beam/erl_nif.c1
-rw-r--r--erts/emulator/beam/io.c1
4 files changed, 2 insertions, 3 deletions
diff --git a/erts/emulator/beam/dist.c b/erts/emulator/beam/dist.c
index d1c2da9074..49a48ac02e 100644
--- a/erts/emulator/beam/dist.c
+++ b/erts/emulator/beam/dist.c
@@ -629,7 +629,6 @@ alloc_dist_obuf(Uint size)
ErtsDistOutputBuf *obuf;
Uint obuf_size = sizeof(ErtsDistOutputBuf)+sizeof(byte)*(size-1);
Binary *bin = erts_bin_drv_alloc(obuf_size);
- erts_refc_init(&bin->refc, 1);
obuf = (ErtsDistOutputBuf *) &bin->orig_bytes[0];
#ifdef DEBUG
obuf->dbg_pattern = ERTS_DIST_OUTPUT_BUF_DBG_PATTERN;
diff --git a/erts/emulator/beam/erl_binary.h b/erts/emulator/beam/erl_binary.h
index cb26ee3407..51072f4b0f 100644
--- a/erts/emulator/beam/erl_binary.h
+++ b/erts/emulator/beam/erl_binary.h
@@ -375,6 +375,7 @@ erts_bin_drv_alloc_fnf(Uint size)
if (res) {
res->orig_size = size;
res->flags = BIN_FLAG_DRV;
+ erts_refc_init(&res->refc, 1);
}
return res;
}
@@ -393,6 +394,7 @@ erts_bin_drv_alloc(Uint size)
ERTS_CHK_BIN_ALIGNMENT(res);
res->orig_size = size;
res->flags = BIN_FLAG_DRV;
+ erts_refc_init(&res->refc, 1);
return res;
}
diff --git a/erts/emulator/beam/erl_nif.c b/erts/emulator/beam/erl_nif.c
index deed74ee49..94d25ba85a 100644
--- a/erts/emulator/beam/erl_nif.c
+++ b/erts/emulator/beam/erl_nif.c
@@ -1074,7 +1074,6 @@ int enif_alloc_binary(size_t size, ErlNifBinary* bin)
if (refbin == NULL) {
return 0; /* The NIF must take action */
}
- erts_refc_init(&refbin->refc, 1);
bin->size = size;
bin->data = (unsigned char*) refbin->orig_bytes;
diff --git a/erts/emulator/beam/io.c b/erts/emulator/beam/io.c
index c85f900de5..36b8ee6860 100644
--- a/erts/emulator/beam/io.c
+++ b/erts/emulator/beam/io.c
@@ -6938,7 +6938,6 @@ driver_alloc_binary(ErlDrvSizeT size)
bin = erts_bin_drv_alloc_fnf((Uint) size);
if (!bin)
return NULL; /* The driver write must take action */
- erts_refc_init(&bin->refc, 1);
return Binary2ErlDrvBinary(bin);
}