aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-12-13 14:08:49 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-12-13 14:08:49 +0000
commit3aea0d3d68a5b508cf76b0622ba208ca7c9fe42c (patch)
tree291f9a3b8ebcb6cd676f22d95cbf7043d10a612e
parent9ae920c1b6b274396128ed54b001b4561a1e708f (diff)
Evan Jordan's fix for a memory leak. Bug report 650989.
-rw-r--r--lib/ssluse.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/ssluse.c b/lib/ssluse.c
index 5239cafd4..a79a9a71b 100644
--- a/lib/ssluse.c
+++ b/lib/ssluse.c
@@ -325,10 +325,15 @@ int cert_stuff(struct connectdata *conn,
ssl=SSL_new(conn->ssl.ctx);
x509=SSL_get_certificate(ssl);
-
- if (x509 != NULL)
- EVP_PKEY_copy_parameters(X509_get_pubkey(x509),
- SSL_get_privatekey(ssl));
+
+ /* This version was provided by Evan Jordan and is supposed to not
+ leak memory as the previous version: */
+ if (x509 != NULL) {
+ EVP_PKEY *pktmp = X509_get_pubkey(x509);
+ EVP_PKEY_copy_parameters(pktmp,SSL_get_privatekey(ssl));
+ EVP_PKEY_free(pktmp);
+ }
+
SSL_free(ssl);
/* If we are using DSA, we can copy the parameters from