diff options
Diffstat (limited to 'lib/crypto/c_src/hash.c')
-rw-r--r-- | lib/crypto/c_src/hash.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/crypto/c_src/hash.c b/lib/crypto/c_src/hash.c index a90957f1a7..000eae047a 100644 --- a/lib/crypto/c_src/hash.c +++ b/lib/crypto/c_src/hash.c @@ -130,7 +130,8 @@ ERL_NIF_TERM hash_init_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) ret = atom_notsup; done: - enif_release_resource(ctx); + if (ctx) + enif_release_resource(ctx); return ret; } @@ -167,7 +168,8 @@ ERL_NIF_TERM hash_update_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[] ret = atom_notsup; done: - enif_release_resource(new_ctx); + if (new_ctx) + enif_release_resource(new_ctx); return ret; } |