From 7ff9ba4fe6b245a544514c5473bcffa9f2c31586 Mon Sep 17 00:00:00 2001 From: curt Date: Wed, 24 Jan 2001 20:07:13 +0000 Subject: [PATCH] Close a binary file before we return (if it turns out not to be a binary file) --- simgear/io/sg_binobj.cxx | 4 ++++ 1 file changed, 4 insertions(+) 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; } -- 2.39.5