Fix memory leak in SSL_new if errors occur.
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 76e6509085
)
This commit is contained in:
parent
321ba85899
commit
be617fbaf8
1 changed files with 1 additions and 7 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue