diff options
author | Sverker Eriksson <[email protected]> | 2014-06-04 15:48:49 +0200 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2014-06-04 15:48:49 +0200 |
commit | a0ab904aaa6ddef9af640cfc88c7d8dd221a1fe5 (patch) | |
tree | fedde8ac22f1b590b1131c8ddb26fbb8197430ca /lib | |
parent | 6c5882d0c450121e53bb6a124f1c5443922baa06 (diff) | |
parent | c9e36ab16034bb7fe71f772df6bba22070976bbf (diff) | |
download | otp-a0ab904aaa6ddef9af640cfc88c7d8dd221a1fe5.tar.gz otp-a0ab904aaa6ddef9af640cfc88c7d8dd221a1fe5.tar.bz2 otp-a0ab904aaa6ddef9af640cfc88c7d8dd221a1fe5.zip |
Merge branch 'maint'
Diffstat (limited to 'lib')
-rw-r--r-- | lib/crypto/c_src/crypto.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/crypto/c_src/crypto.c b/lib/crypto/c_src/crypto.c index 3020cadc56..948093d69c 100644 --- a/lib/crypto/c_src/crypto.c +++ b/lib/crypto/c_src/crypto.c @@ -1384,6 +1384,7 @@ static ERL_NIF_TERM hmac_init(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[ ErlNifBinary key; struct hmac_context* obj; const EVP_MD *md; + ERL_NIF_TERM ret; CHECK_OSE_CRYPTO(); @@ -1415,7 +1416,9 @@ static ERL_NIF_TERM hmac_init(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[ HMAC_CTX_init(&obj->ctx); HMAC_Init(&obj->ctx, key.data, key.size, md); - return enif_make_resource(env, obj); + ret = enif_make_resource(env, obj); + enif_release_resource(obj); + return ret; } static ERL_NIF_TERM hmac_update(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) @@ -2506,6 +2509,7 @@ static ERL_NIF_TERM dss_sign_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM ar return enif_make_binary(env, &ret_bin); } else { + enif_release_binary(&ret_bin); return atom_error; } } @@ -2768,6 +2772,7 @@ static ERL_NIF_TERM dh_compute_key_nif(ErlNifEnv* env, int argc, const ERL_NIF_T ret = enif_make_binary(env, &ret_bin); } else { + enif_release_binary(&ret_bin); ret = atom_error; } } |