If we fail to open the box, release the binary we allocate while doing so.

This commit is contained in:
Jesper Louis Andersen 2014-11-19 23:05:32 +01:00
parent ba0e5e535d
commit c074a4b186

View File

@ -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)) {
enif_release_binary(&result);
return nacl_error_tuple(env, "failed_verification");
}