aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/nifs/common/prim_file_nif.c
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2018-10-12 17:47:52 +0200
committerRickard Green <[email protected]>2018-10-12 17:47:52 +0200
commit13baa4384c4c9c49e6d540bc8ae6b8946f2454ed (patch)
treef5b598ca5ced0fbc5c8b200d2a8e730ee9ca6d70 /erts/emulator/nifs/common/prim_file_nif.c
parentac243aeb32d3379a51564d4f2312bbb1a00a5271 (diff)
parentd9682b02b81fa6e23e554b6e017650eb89ecebed (diff)
downloadotp-13baa4384c4c9c49e6d540bc8ae6b8946f2454ed.tar.gz
otp-13baa4384c4c9c49e6d540bc8ae6b8946f2454ed.tar.bz2
otp-13baa4384c4c9c49e6d540bc8ae6b8946f2454ed.zip
Merge branch 'maint-21' into maint
* maint-21: Updated OTP version Prepare release erts: Fix UNC path handling on Windows erts: Fix a compiler warning eldap: Fix race at socket close Fix bug for sockopt pktoptions on BSD erts: Fix memory leak on file read errors
Diffstat (limited to 'erts/emulator/nifs/common/prim_file_nif.c')
-rw-r--r--erts/emulator/nifs/common/prim_file_nif.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/erts/emulator/nifs/common/prim_file_nif.c b/erts/emulator/nifs/common/prim_file_nif.c
index a05d50b333..fd6aaa61f6 100644
--- a/erts/emulator/nifs/common/prim_file_nif.c
+++ b/erts/emulator/nifs/common/prim_file_nif.c
@@ -514,6 +514,7 @@ static ERL_NIF_TERM read_nif_impl(efile_data_t *d, ErlNifEnv *env, int argc, con
ASSERT(bytes_read <= block_size);
if(bytes_read < 0) {
+ enif_release_binary(&result);
return posix_error_to_tuple(env, d->posix_errno);
} else if(bytes_read == 0) {
enif_release_binary(&result);
@@ -576,6 +577,7 @@ static ERL_NIF_TERM pread_nif_impl(efile_data_t *d, ErlNifEnv *env, int argc, co
bytes_read = efile_preadv(d, offset, read_vec, 1);
if(bytes_read < 0) {
+ enif_release_binary(&result);
return posix_error_to_tuple(env, d->posix_errno);
} else if(bytes_read == 0) {
enif_release_binary(&result);
@@ -802,6 +804,7 @@ static ERL_NIF_TERM ipread_s32bu_p32bu_nif_impl(efile_data_t *d, ErlNifEnv *env,
bytes_read = efile_preadv(d, payload_offset, read_vec, 1);
if(bytes_read < 0) {
+ enif_release_binary(&payload);
return posix_error_to_tuple(env, d->posix_errno);
} else if(bytes_read == 0) {
enif_release_binary(&payload);