aboutsummaryrefslogtreecommitdiff
path: root/ssl/ssltest.c
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2000-04-06 22:25:49 +0000
committerBodo Möller <bodo@openssl.org>2000-04-06 22:25:49 +0000
commit46b3bd54544caf828dcbcac093b5341c10802459 (patch)
treec5c766eb36a062daef261f88088867bae866b5e2 /ssl/ssltest.c
parent51175595b32cf1c32b1c09e644f279a05fbcb2ba (diff)
downloadopenssl-46b3bd54544caf828dcbcac093b5341c10802459.zip
openssl-46b3bd54544caf828dcbcac093b5341c10802459.tar.gz
openssl-46b3bd54544caf828dcbcac093b5341c10802459.tar.bz2
Avoid memory leak.
Diffstat (limited to 'ssl/ssltest.c')
-rw-r--r--ssl/ssltest.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/ssl/ssltest.c b/ssl/ssltest.c
index dde3579..caf5876 100644
--- a/ssl/ssltest.c
+++ b/ssl/ssltest.c
@@ -88,6 +88,7 @@
static int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx);
#ifndef NO_RSA
static RSA MS_CALLBACK *tmp_rsa_cb(SSL *s, int is_export,int keylength);
+static void free_tmp_rsa(void);
#endif
#ifndef NO_DH
static DH *get_dh512(void);
@@ -528,6 +529,9 @@ end:
if (bio_stdout != NULL) BIO_free(bio_stdout);
+#ifndef NO_RSA
+ free_tmp_rsa();
+#endif
ERR_free_strings();
ERR_remove_state(0);
EVP_cleanup();
@@ -1242,10 +1246,10 @@ static int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx)
}
#ifndef NO_RSA
+static RSA *rsa_tmp=NULL;
+
static RSA MS_CALLBACK *tmp_rsa_cb(SSL *s, int is_export, int keylength)
{
- static RSA *rsa_tmp=NULL;
-
if (rsa_tmp == NULL)
{
BIO_printf(bio_err,"Generating temp (%d bit) RSA key...",keylength);
@@ -1256,6 +1260,15 @@ static RSA MS_CALLBACK *tmp_rsa_cb(SSL *s, int is_export, int keylength)
}
return(rsa_tmp);
}
+
+static void free_tmp_rsa(void)
+ {
+ if (rsa_tmp != NULL)
+ {
+ RSA_free(rsa_tmp);
+ rsa_tmp = NULL;
+ }
+ }
#endif
#ifndef NO_DH