mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-01-11 02:35:39 +00:00
Backport 1.3: Resource leak fix on windows
Fix a resource leak on windows platform, in mbedtls_x509_crt_parse_path, in case a failure. when an error occurs, goto cleanup, and free the resource, instead of returning error code immediately.
This commit is contained in:
parent
7771824235
commit
454da1fa6f
|
@ -8,6 +8,9 @@ Bugfix
|
|||
* Replace preproccessor condition from #if defined(MBEDTLS_THREADING_PTHREAD)
|
||||
to #if defined(MBEDTLS_THREADING_C) as the library cannot assume they will
|
||||
always be implemented by pthread support. Fix for #696
|
||||
* Fix resource leak on windows platform, in mbedtls_x509_crt_parse_path.
|
||||
In case of failure, when an error occures, goto cleanup.
|
||||
Found by redplait #590
|
||||
|
||||
= mbed TLS 1.3.20 branch released 2017-06-21
|
||||
|
||||
|
|
|
@ -1014,7 +1014,10 @@ int x509_crt_parse_path( x509_crt *chain, const char *path )
|
|||
p, (int) len - 1,
|
||||
NULL, NULL );
|
||||
if( w_ret == 0 )
|
||||
return( POLARSSL_ERR_X509_FILE_IO_ERROR );
|
||||
{
|
||||
ret = POLARSSL_ERR_X509_FILE_IO_ERROR;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
w_ret = x509_crt_parse_file( chain, filename );
|
||||
if( w_ret < 0 )
|
||||
|
@ -1027,6 +1030,7 @@ int x509_crt_parse_path( x509_crt *chain, const char *path )
|
|||
if( GetLastError() != ERROR_NO_MORE_FILES )
|
||||
ret = POLARSSL_ERR_X509_FILE_IO_ERROR;
|
||||
|
||||
cleanup:
|
||||
FindClose( hFind );
|
||||
#else /* _WIN32 */
|
||||
int t_ret;
|
||||
|
|
Loading…
Reference in a new issue