Removed unneccessary close

This commit is contained in:
Robert Osfield 2016-06-28 09:21:30 +01:00
parent 9253ea845b
commit 6937a8fcd3
3 changed files with 21 additions and 5 deletions

View File

@ -162,7 +162,6 @@ load_md2 (const char *filename, const osgDB::ReaderWriter::Options* options)
file_fd = open (filename, O_RDONLY); file_fd = open (filename, O_RDONLY);
if (file_fd <= 0) { if (file_fd <= 0) {
close (file_fd);
return NULL; return NULL;
} }

View File

@ -113,7 +113,13 @@ int *numComponents_ret)
picerror = ERROR_NO_ERROR; picerror = ERROR_NO_ERROR;
fseek(fp, 2, SEEK_SET); if (!fseek(fp, 2, SEEK_SET))
{
picerror = ERROR_READING_HEADER;
fclose(fp);
return NULL;
}
if (!readint16(fp, &w)) if (!readint16(fp, &w))
{ {
picerror = ERROR_READING_HEADER; picerror = ERROR_READING_HEADER;
@ -121,7 +127,13 @@ int *numComponents_ret)
return NULL; return NULL;
} }
fseek(fp, 4, SEEK_SET); if (!fseek(fp, 4, SEEK_SET))
{
picerror = ERROR_READING_HEADER;
fclose(fp);
return NULL;
}
if (!readint16(fp, &h)) if (!readint16(fp, &h))
{ {
picerror = ERROR_READING_HEADER; picerror = ERROR_READING_HEADER;
@ -137,7 +149,13 @@ int *numComponents_ret)
fclose(fp); fclose(fp);
return NULL; return NULL;
} }
fseek(fp, 32, SEEK_SET);
if (!fseek(fp, 32, SEEK_SET))
{
picerror = ERROR_READING_HEADER;
fclose(fp);
return NULL;
}
if (fread(&palette, 3, 256, fp) != 256) if (fread(&palette, 3, 256, fp) != 256)
{ {

View File

@ -25,7 +25,6 @@ ESRIShapeParser::ESRIShapeParser( const std::string fileName, bool useDouble ):
if( (fd = open( fileName.c_str(), O_RDONLY )) <= 0 ) if( (fd = open( fileName.c_str(), O_RDONLY )) <= 0 )
#endif #endif
{ {
if (fd) close ( fd );
perror( fileName.c_str() ); perror( fileName.c_str() );
return ; return ;
} }