If we fail to open the box, release the binary we allocate while doing so.
This commit is contained in:
parent
ba0e5e535d
commit
c074a4b186
@ -125,6 +125,7 @@ ERL_NIF_TERM enif_crypto_box_open(ErlNifEnv *env, int argc, ERL_NIF_TERM const a
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (crypto_box_open(result.data, padded_ciphertext.data, padded_ciphertext.size, nonce.data, pk.data, sk.data)) {
|
if (crypto_box_open(result.data, padded_ciphertext.data, padded_ciphertext.size, nonce.data, pk.data, sk.data)) {
|
||||||
|
enif_release_binary(&result);
|
||||||
return nacl_error_tuple(env, "failed_verification");
|
return nacl_error_tuple(env, "failed_verification");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user