diff options
author | Matt Caswell <matt@openssl.org> | 2014-12-04 09:46:44 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2014-12-08 16:48:05 +0000 |
commit | be617fbaf89225989c2231f98565c1c47bd22992 (patch) | |
tree | f74249262b9643a8a0c1bb9a4d9442fb3d6f1352 | |
parent | 321ba85899ce7246db3791457c711ad586b6d3f8 (diff) |
Fix memory leak in SSL_new if errors occur.
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 76e6509085ea96df0ca542568ee2596343711307)
-rw-r--r-- | ssl/ssl_lib.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index f5c8ca9fec..81f976a579 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -383,13 +383,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); } |