FS#1646 close fp in error case to avoid resource leak

This commit is contained in:
Thomas Penteker 2018-06-01 01:03:13 +02:00
parent 54dc911470
commit 2fd99a3c8f

View File

@ -256,6 +256,7 @@ Repository::initFromCache( const string& cacheFile )
if ( fgets( input, length, fp ) ) { if ( fgets( input, length, fp ) ) {
line = stripWhiteSpace( input ); line = stripWhiteSpace( input );
if ( line != CACHE_VERSION ) { if ( line != CACHE_VERSION ) {
close( fp );
return FORMAT_ERR; return FORMAT_ERR;
} }
} }