Fix potential resource leak in X.509 parse dir

Found with fbinfer.
This commit is contained in:
Manuel Pégourié-Gonnard 2015-06-22 18:39:57 +02:00
parent bcf13bab5d
commit f9b85d96a9

View file

@ -1155,7 +1155,10 @@ int mbedtls_x509_crt_parse_path( mbedtls_x509_crt *chain, const char *path )
#if defined(MBEDTLS_THREADING_PTHREAD) #if defined(MBEDTLS_THREADING_PTHREAD)
if( ( ret = mbedtls_mutex_lock( &mbedtls_threading_readdir_mutex ) ) != 0 ) if( ( ret = mbedtls_mutex_lock( &mbedtls_threading_readdir_mutex ) ) != 0 )
{
closedir( dir );
return( ret ); return( ret );
}
#endif #endif
while( ( entry = readdir( dir ) ) != NULL ) while( ( entry = readdir( dir ) ) != NULL )