Fix memory leak in x509_crl_parse()

The memory leak call was caused by missing calls to pem_free().
This commit is contained in:
Andres AG 2017-01-23 14:58:27 +00:00 committed by Simon Butcher
parent 9fb2828aee
commit 03af0e0151
2 changed files with 6 additions and 2 deletions

View file

@ -37,6 +37,9 @@ Bugfix
cause buffer bound checks to be bypassed. Found by Eyal Itkin.
* Fixed potential arithmetic overflow in mbedtls_base64_decode() that could
cause buffer bound checks to be bypassed. Found by Eyal Itkin.
* Fix potential memory leak in x509_crl_parse(). The leak was caused by
missing calls to pem_free() in cases when a
POLARSSL_ERR_PEM_NO_HEADER_FOOTER_PRESENT error was encountered.
= mbed TLS 1.3.18 branch 2016-10-17

View file

@ -520,16 +520,17 @@ int x509_crl_parse( x509_crl *chain, const unsigned char *buf, size_t buflen )
if( ( ret = x509_crl_parse_der( chain,
pem.buf, pem.buflen ) ) != 0 )
{
pem_free( &pem );
return( ret );
}
pem_free( &pem );
}
else if( is_pem )
{
pem_free( &pem );
return( ret );
}
pem_free( &pem );
}
while( is_pem && buflen > 0 );