From 4a18cddd168bec6a4e22ecf733149efa4d85b3a5 Mon Sep 17 00:00:00 2001 From: Ben Laurie Date: Mon, 4 Jan 1999 21:39:34 +0000 Subject: [PATCH] Only free if it ain't NULL. --- CHANGES | 3 +++ crypto/rsa/rsa_eay.c | 3 ++- crypto/rsa/rsa_enc.c | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 36064507e8..b2e31d6cf4 100644 --- a/CHANGES +++ b/CHANGES @@ -5,6 +5,9 @@ Changes between 0.9.1c and 0.9.2 + *) rsa_eay.c would attempt to free a NULL context. + [Arne Ansper ] + *) BIO_s_socket() had a broken should_retry() on Windoze. [Arne Ansper ] diff --git a/crypto/rsa/rsa_eay.c b/crypto/rsa/rsa_eay.c index b4050506c3..ec143e873b 100644 --- a/crypto/rsa/rsa_eay.c +++ b/crypto/rsa/rsa_eay.c @@ -474,7 +474,8 @@ RSA *rsa; err: BN_clear_free(&m1); BN_clear_free(&r1); - BN_CTX_free(ctx); + if(ctx) + BN_CTX_free(ctx); return(ret); } diff --git a/crypto/rsa/rsa_enc.c b/crypto/rsa/rsa_enc.c index c4a4ad5a60..5f91239da5 100644 --- a/crypto/rsa/rsa_enc.c +++ b/crypto/rsa/rsa_enc.c @@ -531,7 +531,8 @@ RSA *rsa; err: if (m1 != NULL) BN_free(m1); if (r1 != NULL) BN_free(r1); - BN_CTX_free(ctx); + if(ctx != NULL) + BN_CTX_free(ctx); return(ret); } -- 2.34.1