summaryrefslogtreecommitdiffstats
path: root/ssl/ssl_lib.c
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:51:01 +0000
commit38afaa48ec10d6256179b89639ce07ff57b7fe0d (patch)
tree008713509414c2bb11b837dc7f1e69e78cda3597 /ssl/ssl_lib.c
parent954818fe60dc4a4514700d185d79afe6fec72afb (diff)
Fix memory leak in SSL_new if errors occur.
Reviewed-by: Richard Levitte <levitte@openssl.org> (cherry picked from commit 76e6509085ea96df0ca542568ee2596343711307)
Diffstat (limited to 'ssl/ssl_lib.c')
-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 ac40c6ac44..bd8cc68641 100644
--- a/ssl/ssl_lib.c
+++ b/ssl/ssl_lib.c
@@ -377,13 +377,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);
}