diff options
author | Sverker Eriksson <[email protected]> | 2017-04-11 16:28:12 +0200 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2017-04-11 16:28:12 +0200 |
commit | 486a758ef245effab01d880493a0274de49c1797 (patch) | |
tree | a506758099a76c92b429f070f3e80b9932c5e916 /erts/emulator/beam/erl_nif.c | |
parent | 37bdfb3b5b56c2311db1780b052b7e2c0f139cef (diff) | |
download | otp-486a758ef245effab01d880493a0274de49c1797.tar.gz otp-486a758ef245effab01d880493a0274de49c1797.tar.bz2 otp-486a758ef245effab01d880493a0274de49c1797.zip |
erts: Introduce erts_bin_release
Diffstat (limited to 'erts/emulator/beam/erl_nif.c')
-rw-r--r-- | erts/emulator/beam/erl_nif.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/erts/emulator/beam/erl_nif.c b/erts/emulator/beam/erl_nif.c index 94d25ba85a..e76226c5eb 100644 --- a/erts/emulator/beam/erl_nif.c +++ b/erts/emulator/beam/erl_nif.c @@ -1112,9 +1112,7 @@ void enif_release_binary(ErlNifBinary* bin) if (bin->ref_bin != NULL) { Binary* refbin = bin->ref_bin; ASSERT(bin->bin_term == THE_NON_VALUE); - if (erts_refc_dectest(&refbin->refc, 0) == 0) { - erts_bin_free(refbin); - } + erts_bin_release(refbin); } #ifdef DEBUG bin->data = NULL; @@ -2347,9 +2345,7 @@ void erts_fire_nif_monitor(ErtsResource* resource, Eterm pid, Eterm ref) resource->type->down(&msg_env.env, resource->data, &nif_pid, &nif_monitor); post_nif_noproc(&msg_env); - if (erts_refc_dectest(&bin->binary.refc, 0) == 0) { - erts_bin_free(&bin->binary); - } + erts_bin_release(&bin->binary); } erts_destroy_monitor(rmon); } @@ -2407,9 +2403,7 @@ void enif_release_resource(void* obj) #ifdef DEBUG erts_refc_dec(&resource->nif_refc, 0); #endif - if (erts_refc_dectest(&bin->binary.refc, 0) == 0) { - erts_bin_free(&bin->binary); - } + erts_bin_release(&bin->binary); } void enif_keep_resource(void* obj) |