From: curt Date: Wed, 24 Jan 2001 20:07:13 +0000 (+0000) Subject: Close a binary file before we return (if it turns out not to be a binary file) X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=7ff9ba4fe6b245a544514c5473bcffa9f2c31586;p=simgear.git Close a binary file before we return (if it turns out not to be a binary file) --- diff --git a/simgear/io/sg_binobj.cxx b/simgear/io/sg_binobj.cxx index 0e7082d0..359ee4cf 100644 --- a/simgear/io/sg_binobj.cxx +++ b/simgear/io/sg_binobj.cxx @@ -180,6 +180,7 @@ bool SGBinObject::read_bin( const string& file ) { if ( (fp = gzopen( filegz.c_str(), "rb" )) == NULL ) { // cout << "ERROR: opening " << file << " or " << filegz // << "for reading!" << endl; + return false; } } @@ -197,6 +198,9 @@ bool SGBinObject::read_bin( const string& file ) { version = (header & 0x0000FFFF); // cout << "File version = " << version << endl; } else { + // close the file before we return + gzclose(fp); + return false; }