diff options
author | Doug Hogan <[email protected]> | 2019-01-05 12:35:55 -0800 |
---|---|---|
committer | Doug Hogan <[email protected]> | 2019-01-08 01:11:59 -0800 |
commit | 70b61618b7001c03111c0ff8dfceaeead0173b69 (patch) | |
tree | e5a3e5b58259b72bdfb84a4adbab14d93c16bea1 /lib/crypto | |
parent | 4e3bc5e7cdb7427a3b6c892fe30e56c63d0b570c (diff) | |
download | otp-70b61618b7001c03111c0ff8dfceaeead0173b69.tar.gz otp-70b61618b7001c03111c0ff8dfceaeead0173b69.tar.bz2 otp-70b61618b7001c03111c0ff8dfceaeead0173b69.zip |
Revamp init_hash_ctx()
Diffstat (limited to 'lib/crypto')
-rw-r--r-- | lib/crypto/c_src/hash.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/crypto/c_src/hash.c b/lib/crypto/c_src/hash.c index c9fcd35ca2..a90957f1a7 100644 --- a/lib/crypto/c_src/hash.c +++ b/lib/crypto/c_src/hash.c @@ -48,13 +48,15 @@ int init_hash_ctx(ErlNifEnv* env) { (ErlNifResourceDtor*) evp_md_ctx_dtor, ERL_NIF_RT_CREATE|ERL_NIF_RT_TAKEOVER, NULL); - if (evp_md_ctx_rtype == NULL) { - PRINTF_ERR0("CRYPTO: Could not open resource type 'EVP_MD_CTX'"); - return 0; - } + if (evp_md_ctx_rtype == NULL) + goto err; #endif return 1; + + err: + PRINTF_ERR0("CRYPTO: Could not open resource type 'EVP_MD_CTX'"); + return 0; } ERL_NIF_TERM hash_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) |