aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDoug Hogan <[email protected]>2019-01-07 06:44:06 -0800
committerDoug Hogan <[email protected]>2019-01-07 20:17:55 -0800
commit5904d78fbea85c481dc595df1e279f068acf6d12 (patch)
tree4c708b61631fe80982e321c54cee53ee284973a1 /lib
parent7e95687c086f833805d520c33fe96e7e42fc8f6c (diff)
downloadotp-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.c6
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