diff options
author | Doug Hogan <[email protected]> | 2019-01-07 06:43:10 -0800 |
---|---|---|
committer | Doug Hogan <[email protected]> | 2019-01-07 20:17:55 -0800 |
commit | 46a101341ecb4cb800e685f5c1897ed474c4ab7b (patch) | |
tree | 5e39faa8d738098500c85ce0a5cfae6d533fe528 /lib/crypto/c_src/cipher.c | |
parent | 7969ceefad3bd2a534242da19d4aede1d138765f (diff) | |
download | otp-46a101341ecb4cb800e685f5c1897ed474c4ab7b.tar.gz otp-46a101341ecb4cb800e685f5c1897ed474c4ab7b.tar.bz2 otp-46a101341ecb4cb800e685f5c1897ed474c4ab7b.zip |
Revamp evp_cipher_ctx_dtor()
Make it NULL safe.
Diffstat (limited to 'lib/crypto/c_src/cipher.c')
-rw-r--r-- | lib/crypto/c_src/cipher.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/crypto/c_src/cipher.c b/lib/crypto/c_src/cipher.c index 6580cb183f..cda9b15291 100644 --- a/lib/crypto/c_src/cipher.c +++ b/lib/crypto/c_src/cipher.c @@ -74,7 +74,11 @@ static struct cipher_type_t cipher_types[] = ErlNifResourceType* evp_cipher_ctx_rtype; static void evp_cipher_ctx_dtor(ErlNifEnv* env, struct evp_cipher_ctx* ctx) { - EVP_CIPHER_CTX_free(ctx->ctx); + if (ctx == NULL) + return; + + if (ctx->ctx) + EVP_CIPHER_CTX_free(ctx->ctx); } #endif |