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:44:09 +0000 |
commit | 9809ab965bfc011302422f01db91a4f6bfccd20c (patch) | |
tree | 0745cfd871b25ad17b9f837a7f1f96f53961679e | |
parent | bd34823e554706e822ae8990afa9454d94e4ce68 (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 51a0ef7ca6..8f49a6f184 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -416,13 +416,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); } |