Fix memory leak on missed session reuse
This commit is contained in:
parent
e8ea0c0421
commit
bfb355c33b
@ -2461,6 +2461,13 @@ int ssl_parse_certificate( ssl_context *ssl )
|
||||
return( POLARSSL_ERR_SSL_BAD_HS_CERTIFICATE );
|
||||
}
|
||||
|
||||
/* In case we tried to reuse a session but it failed */
|
||||
if( ssl->session_negotiate->peer_cert != NULL )
|
||||
{
|
||||
x509_free( ssl->session_negotiate->peer_cert );
|
||||
polarssl_free( ssl->session_negotiate->peer_cert );
|
||||
}
|
||||
|
||||
if( ( ssl->session_negotiate->peer_cert = (x509_cert *) polarssl_malloc(
|
||||
sizeof( x509_cert ) ) ) == NULL )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user