bug-ddrescue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-ddrescue] [PATCH 5/5] mapfile: Add several missing fclose calls


From: Rosen Penev
Subject: [Bug-ddrescue] [PATCH 5/5] mapfile: Add several missing fclose calls
Date: Fri, 2 Aug 2019 14:52:36 -0700

Found with clang-analyzer.

Signed-off-by: Rosen Penev <address@hidden>
---
 mapfile.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mapfile.cc b/mapfile.cc
index b4b9071..1f4d2e3 100644
--- a/mapfile.cc
+++ b/mapfile.cc
@@ -231,7 +231,7 @@ bool Mapfile::read_mapfile( const int 
default_sblock_status, const bool ro )
         current_pass_ >= 1 )
       current_status_ = Status( ch );
     else
-      { show_mapfile_error( filename_, linenum ); std::exit( 2 ); }
+      { std::fclose( f ); show_mapfile_error( filename_, linenum ); std::exit( 
2 ); }
 
     while( true )
       {
@@ -252,12 +252,12 @@ bool Mapfile::read_mapfile( const int 
default_sblock_status, const bool ro )
                                 Sblock::Status( default_sblock_status ) );
               sblock_vector.push_back( sb2 ); }
           else if( end > 0 )
-            { show_mapfile_error( filename_, linenum ); std::exit( 2 ); }
+            { std::fclose( f ); show_mapfile_error( filename_, linenum ); 
std::exit( 2 ); }
           }
         sblock_vector.push_back( sb );
         }
       else
-        { show_mapfile_error( filename_, linenum ); std::exit( 2 ); }
+        { std::fclose( f ); show_mapfile_error( filename_, linenum ); 
std::exit( 2 ); }
       }
     }
   if( std::ferror( f ) || !std::feof( f ) || std::fclose( f ) != 0 )
-- 
2.17.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]