summaryrefslogtreecommitdiffstats
path: root/ssl
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2014-12-04 09:46:44 +0000
committerMatt Caswell <matt@openssl.org>2014-12-08 16:42:59 +0000
commit76e6509085ea96df0ca542568ee2596343711307 (patch)
tree2b6cd61098b52b50c7097d38b22221340e75c3fc /ssl
parent7bca0a1db5f0fc2d2c671eddac19e9e92075a5f4 (diff)
Fix memory leak in SSL_new if errors occur.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'ssl')
-rw-r--r--ssl/ssl_lib.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c
index 743204cd15..a4d565fb4a 100644
--- a/ssl/ssl_lib.c
+++ b/ssl/ssl_lib.c
@@ -417,13 +417,7 @@ SSL *SSL_new(SSL_CTX *ctx)
return(s);
err:
if (s != NULL)
- {
- if (s->cert != NULL)
- ssl_cert_free(s->cert);
- if (s->ctx != NULL)
- SSL_CTX_free(s->ctx); /* decrement reference count */
- OPENSSL_free(s);
- }
+ SSL_free(s);
SSLerr(SSL_F_SSL_NEW,ERR_R_MALLOC_FAILURE);
return(NULL);
}