aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto
diff options
context:
space:
mode:
authorDoug Hogan <[email protected]>2019-01-05 12:36:29 -0800
committerDoug Hogan <[email protected]>2019-01-08 01:11:59 -0800
commitadc780e8b1a2c9fd555f6435de851ed0ab609094 (patch)
treed949030339aa45864a391f390340115c573c8333 /lib/crypto
parent70b61618b7001c03111c0ff8dfceaeead0173b69 (diff)
downloadotp-adc780e8b1a2c9fd555f6435de851ed0ab609094.tar.gz
otp-adc780e8b1a2c9fd555f6435de851ed0ab609094.tar.bz2
otp-adc780e8b1a2c9fd555f6435de851ed0ab609094.zip
Revamp init_hmac_ctx()
Diffstat (limited to 'lib/crypto')
-rw-r--r--lib/crypto/c_src/hmac.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/crypto/c_src/hmac.c b/lib/crypto/c_src/hmac.c
index 08d9049caa..a5ff35c706 100644
--- a/lib/crypto/c_src/hmac.c
+++ b/lib/crypto/c_src/hmac.c
@@ -37,11 +37,14 @@ int init_hmac_ctx(ErlNifEnv *env) {
(ErlNifResourceDtor*) hmac_context_dtor,
ERL_NIF_RT_CREATE|ERL_NIF_RT_TAKEOVER,
NULL);
- if (hmac_context_rtype == NULL) {
- PRINTF_ERR0("CRYPTO: Could not open resource type 'hmac_context'");
- return 0;
- }
+ if (hmac_context_rtype == NULL)
+ goto err;
+
return 1;
+
+ err:
+ PRINTF_ERR0("CRYPTO: Could not open resource type 'hmac_context'");
+ return 0;
}
ERL_NIF_TERM hmac_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])