Fix memory leak in SSL_new if errors occur.
Reviewed-by: Richard Levitte <levitte@openssl.org> (cherry picked from commit 76e6509085ea96df0ca542568ee2596343711307)
This commit is contained in:
parent
bd34823e55
commit
9809ab965b
@ -416,13 +416,7 @@ SSL *SSL_new(SSL_CTX *ctx)
|
|||||||
return(s);
|
return(s);
|
||||||
err:
|
err:
|
||||||
if (s != NULL)
|
if (s != NULL)
|
||||||
{
|
SSL_free(s);
|
||||||
if (s->cert != NULL)
|
|
||||||
ssl_cert_free(s->cert);
|
|
||||||
if (s->ctx != NULL)
|
|
||||||
SSL_CTX_free(s->ctx); /* decrement reference count */
|
|
||||||
OPENSSL_free(s);
|
|
||||||
}
|
|
||||||
SSLerr(SSL_F_SSL_NEW,ERR_R_MALLOC_FAILURE);
|
SSLerr(SSL_F_SSL_NEW,ERR_R_MALLOC_FAILURE);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user