Fixed memory leak in ssl_free() and ssl_reset() for active session

This commit is contained in:
Paul Bakker 2013-02-14 11:19:38 +01:00
parent c7a2da437e
commit c0463502ff
2 changed files with 17 additions and 0 deletions

View File

@ -1,5 +1,9 @@
PolarSSL ChangeLog
= Master
Bugfix
* Fixed memory leak in ssl_free() and ssl_reset() for active session
= Version 1.2.5 released 2013-02-02
Changes
* Allow enabling of dummy error_strerror() to support some use-cases

View File

@ -3025,6 +3025,13 @@ int ssl_session_reset( ssl_context *ssl )
ssl->transform = NULL;
}
if( ssl->session )
{
ssl_session_free( ssl->session );
free( ssl->session );
ssl->session = NULL;
}
if( ( ret = ssl_handshake_init( ssl ) ) != 0 )
return( ret );
@ -3891,6 +3898,12 @@ void ssl_free( ssl_context *ssl )
free( ssl->session_negotiate );
}
if( ssl->session )
{
ssl_session_free( ssl->session );
free( ssl->session );
}
if ( ssl->hostname != NULL)
{
memset( ssl->hostname, 0, ssl->hostname_len );