diff options
author | Doug Hogan <[email protected]> | 2019-01-07 06:44:06 -0800 |
---|---|---|
committer | Doug Hogan <[email protected]> | 2019-01-07 20:17:55 -0800 |
commit | 5904d78fbea85c481dc595df1e279f068acf6d12 (patch) | |
tree | 4c708b61631fe80982e321c54cee53ee284973a1 /lib | |
parent | 7e95687c086f833805d520c33fe96e7e42fc8f6c (diff) | |
download | otp-5904d78fbea85c481dc595df1e279f068acf6d12.tar.gz otp-5904d78fbea85c481dc595df1e279f068acf6d12.tar.bz2 otp-5904d78fbea85c481dc595df1e279f068acf6d12.zip |
Revamp evp_md_ctx_dtor()
Make it NULL safe.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/crypto/c_src/hash.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/crypto/c_src/hash.c b/lib/crypto/c_src/hash.c index 52748dc933..c8835296ea 100644 --- a/lib/crypto/c_src/hash.c +++ b/lib/crypto/c_src/hash.c @@ -34,7 +34,11 @@ struct evp_md_ctx { static ErlNifResourceType* evp_md_ctx_rtype; static void evp_md_ctx_dtor(ErlNifEnv* env, struct evp_md_ctx *ctx) { - EVP_MD_CTX_free(ctx->ctx); + if (ctx == NULL) + return; + + if (ctx->ctx) + EVP_MD_CTX_free(ctx->ctx); } #endif |