diff options
Diffstat (limited to 'lib/crypto/c_src/chacha20.c')
-rw-r--r-- | lib/crypto/c_src/chacha20.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/crypto/c_src/chacha20.c b/lib/crypto/c_src/chacha20.c index 03b8589524..51a24a43e9 100644 --- a/lib/crypto/c_src/chacha20.c +++ b/lib/crypto/c_src/chacha20.c @@ -63,7 +63,8 @@ ERL_NIF_TERM chacha20_stream_init(ErlNifEnv* env, int argc, const ERL_NIF_TERM a ret = enif_make_badarg(env); done: - enif_release_resource(ctx); + if (ctx) + enif_release_resource(ctx); return ret; #else @@ -113,7 +114,8 @@ ERL_NIF_TERM chacha20_stream_crypt(ErlNifEnv* env, int argc, const ERL_NIF_TERM ret = enif_make_badarg(env); done: - enif_release_resource(new_ctx); + if (new_ctx) + enif_release_resource(new_ctx); return ret; #else |